: We have a product catalog that is searchable via Solr, by default we want to : exclude results from the "Adult" category unless the search terms match a : predetermined list of words.
I ment to reply to this yesterday and forgot ... the most straightforward way to deal with tis (as i think you found) is external to Solr ... if you identify one of the words in your input as denoting an adult category, then add "category:Adult" to your query. But another option, is to identify words in products which are adult themed when indexing the products, and put them in a seperate adultText field, then structure your queries like this... +(regularText:doll adultText:doll) +(category:Family adultText:doll) ...since "doll" is considered a familar frendly word, it would never appear in adultText, so no adult products would match, just ones in the Family category that had "doll" in the regular text field, meanwhile in this case... +(regularText:aphrodisiac adultText:aphrodisiac) +(category:Family adultText:aphrodisiac) ...aphrodisiac will never be in regularText, so only adult products will match. assuming you want strict matching, you can extend it to work with multi-word input using something like... +(regularText:(sex doll) adultText:(sex doll) +(category:Family adultText:(sex doll)) ...sex would only ever be in aultTeext, doll would only ever be in regularText, so only adult products would match, but they would still be required to have the word doll in them. (boosting on exact phrase matches could still be done, using an optional phrase query on a third field containing all of the text) ...all of which is really a lot of work that doesn't make much sense -- if you have a way of identifying "adult" words, you might as well do it at query time instead of index time -- but it is possible. -Hoss