Is it possible for us to manually inject our own keywords into the searchindex via an event or something? eg.

Event::on(Entry::class, Entry::EVENT_AFTER_SAVE, function (ModelEvent $event) {
    $event->sender->addKeywords('blah blah blah');

We want to be able to automatically append extra keywords to some posts to increase the searchability, e.g. The Author name, API results etc.


  • 1
    We add a plain text field and add comma separated values to that, which is probably the most suitable method.
    – Joshua M
    Oct 9 '20 at 15:26
  • This would be visible to the user though? and wouldn't automatically populate with internal values?
    – Owen
    Oct 13 '20 at 11:45
  • Visible to the client user, or visible to the customer on the front end? It wont be visible on the front end unless you output it. You can populate it with internal values using the AFTER_SAVE function and setFieldValues().
    – Joshua M
    Oct 15 '20 at 14:11
  • We don't want anybody to be able to see it, it should purely exist in code-land really
    – Owen
    Oct 15 '20 at 17:02
  • Also this would create an infinite loop. When i save the element, it will trigger AFTER_SAVE, which will run my code etc etc
    – Owen
    Oct 20 '20 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.