简体   繁体   English

如何在 Lucene 7.4.0 中进行多查询搜索?

[英]How to do a multi query search in Lucene 7.4.0?

I have two queries, one of them is boosted, and I want to combine them into one new query.我有两个查询,其中一个被提升,我想将它们组合成一个新查询。 I understand that in older version of Lucene you can do it with BooleanQuery using add .我知道在旧版本的 Lucene 中,您可以使用add使用BooleanQuery来完成。 But in the version I'm using, that method seems to no longer exists.但是在我使用的版本中,该方法似乎不再存在。 So how do I do it now?那么我现在该怎么做呢?

To add queries into a 'BooleanQuery', now I have to use the 'Builder'.要将查询添加到“BooleanQuery”中,现在我必须使用“Builder”。 So if I want to add queries, the code line should be something like new BooleanQuery().Builder().add(query1).add(query2).build()所以如果我想添加查询,代码行应该类似于new BooleanQuery().Builder().add(query1).add(query2).build()

Yes, I should've read the migration guide first.是的,我应该先阅读迁移指南。

Also if I want to combine a boosted query and a normal one, I could just concate the strings.另外,如果我想将增强查询和普通查询结合起来,我可以连接字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM