结合Lucene的WildcardQuery和FuzzyQuery [英] Combining Lucene's WildcardQuery with FuzzyQuery

查看:319
本文介绍了结合Lucene的WildcardQuery和FuzzyQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Lucene.Net 2.4.0是否有某种内置支持,可以将针对同一索引的两个不同查询的结果结合起来,类似于对通过单个查询来针对两个或多个索引的支持?

我正在寻找在不强迫的情况下支持尾随通配符和模糊搜索的方法 用户选择一个或另一个.我可以通过执行通配符查询和 依次进行模糊搜索,然后手动将两个结果合并并按单个文档的得分进行排序,希望它们的相对得分有意义.

还有另一种方法吗?

为了澄清:诸如"apoca"和"appockalypze"之类的查询都应产生点击率 如果索引中存在这样的文档,则立即启示"实际上不是将模糊度从0.5增加到1的方法.

解决方案

您可以使用BooleanQuery联接两个或多个查询

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.

解决方案

you could join two or more queries with BooleanQuery

这篇关于结合Lucene的WildcardQuery和FuzzyQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆