[英]Prefered field searching in lucene
I have an index and I want to search it on multiple fields. 我有一个索引,我想在多个字段中搜索它。 I am working on Query Builder for this application wherein I want to give more preference to a certain field than others.
我正在为此应用程序创建查询生成器,其中我希望给某个字段比其他字段更多的优先级。
Let's say the fields are: RollNo, Name, Age
假设这些字段是:
RollNo, Name, Age
In this case, when someone searches with RollNo
field along with Name
, I want to give preference to results which come from RollNo
matching. 在这种情况下,当有人使用
RollNo
字段和Name
搜索时,我想优先考虑RollNo
匹配的结果。
Anybody knows how to do this in Lucene. 任何人都知道如何在Lucene中做到这一点。 I am using Lucene 3.6.
我正在使用Lucene 3.6。
You can use the Query.setBoost() method to boost during query time. 您可以使用Query.setBoost()方法来提高查询时间。
Check boosting part of this document for more information. 有关更多信息,请参见本文档的增强部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.