Combining Lucene's WildcardQuery with FuzzyQuery

筅森魡賤 提交于 2019-12-02 11:48:18

问题


Using Lucene.Net 2.4.0 is there some kind of built-in support for joining the results of two different queries that target the same index, similar to the support for targeting two or more indexes with a single query?

I'm looking for ways to support both trailing wildcard and fuzzy searches without forcing users to choose one or the other. I could achieve this by executing a wildcard query and a fuzzy search sequentially, and then manually merge the two results and sort by the score of the individual documents, in hopes that their relative scores will make sense.

Is there another way?

To clarify: queries such as "apoca" and "appockalypze" should both produce a hit on "Apocalypse Now", given such a document exists in the index, and increasing the fuzzyness from 0.5 to 1 is not really an option.


回答1:


you could join two or more queries with BooleanQuery



来源:https://stackoverflow.com/questions/2296205/combining-lucenes-wildcardquery-with-fuzzyquery

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