Skip to content Skip to sidebar Skip to footer

Exact Match Of Multiple Words In Whoosh

By default, a multiple word search is split into files that have each word separately. How can I override this default and have whoosh search for an exact match? Even though it's m

Solution 1:

Use phrase queries (that is, put double quotes around the words which you want to be matched in your query), e.g. :

"to be or not to be"

However, this only works if the field you're searching in is of type whoosh.fields.TEXT.

As for the performance thing, phrase searches are necessarily slower than "classic search". To do a phrase search, it is first necessary to retrieve all the documents that contain all the terms that you specified in your query (this is the "classic search" part), and then to compare the terms positions between you query and the document to check if it looks like a match.


Post a Comment for "Exact Match Of Multiple Words In Whoosh"