Exact match of multiple words in whoosh

假装没事ソ 提交于 2019-12-01 23:12:38

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!