My customer wants to block certain search terms. If these terms appear in query, these terms should be ignored. We do not want to blacklist the documents. It would be perfectly possible to retrieve a document containing these words, as long as I do not explicitly search for them.
I thought of two possible ways to fulfill this requirement:
A. Removing terms at query time
This sounds like a good idea at first, but things like fuzzy search, wildcards, and boolean operators (EXCEPT, AND, OR) make it hard to implement.
B. Using the Stopword feature at indexing time
I could use stopword feature to avoid having the forbidden words in the index at all.
My Questions:
-
If I use option B, this means I need to rebuild the index when I add or remove a word from the blacklist. Is this correct?
-
Is there a better way? It would be ideal if we could add and remove words from the blacklist without rebuilding the index.
Best Regards
Matthias