Search code examples
django-haystackwhoosh

How can i filter with a stopword list in django haystack (whoosh)


I am making an api call where the user passes a string and the database is queried with that string. The correct results are returned but i want to add stopwords for different languages to use for extra filtering.

When i use words like 'and' etc. in the search it ignores it like it should, but this is only for English.


Solution

  • I created a custom search backend which extends whoosh_backend.SearchBackend and in the build_schema function passed the stopword list to the StemmingAnalyzer.