I have a request to extend an existing "advanced search" form (multiple fields, including keyword and a categories dropdown) so that entries with a category that matches the keyword input are returned.
For example, let's say my entries are all book authors, and among various entry fields like their bio and their published books, there's also a Topic category, and authors may be associated with 0-n categories.
And let's say I have an author Jane Smith, and one of her selected Topic categories is Poetry, but for some reason the word "poetry" does not exist in her bio or any of her book titles or for that matter anywhere at all in her main entry, but rather only as that category selection.
How would I modify my search so that anyone typing "poetry" into the keyword search field (rather than picking it from the Topics dropdown menu field) will get back Jane Smith as one of their results?
Still pretty new to Craft, but I feel like there has to be some way. If not via clever query construction on the results template, then maybe by some kind of way to automatically replicate the text of the author's topic categories into an entry field that's never displayed to users, just only exists to get that text into a place where it's picked up by the search index? Would be grateful for any thoughts. Thanks.
Existing search (this is followed by a bunch more Twig that merges these results with results of other entry types but I don't know that any of that is relevant here):
{% set profileParams = {
section: 'profiles',
search: {
query: 'title:' ~ query ~ ' OR ' ~
'position:' ~ query ~ ' OR ' ~
'jobTitle:' ~ query ~ ' OR ' ~
'institution:' ~ query,
subLeft: true,
subRight: true
},
order: 'score',
limit: null
} %}
[...]
{% set profileEntries = craft.entries( profileParams ) %}