简体   繁体   English

如何在solr dismax中使用“OR”进行高级搜索查询

[英]How do I do advanced search query using “OR” in solr dismax

How can you specify a query like "java with (developer OR programmer)" using solr dismax handler... 如何使用solr dismax处理程序指定“java with(developer OR programmer)”之类的查询...

It works with solr standard handler but not with dismax 它适用于solr标准处理程序,但不适用于dismax

The default for dismax is OR (optional), and if you want terms to be mandatory you must add a plus-sign in front of them. dismax的默认值为OR(可选),如果您希望术语是必需的,则必须在它们前面添加加号。 So assuming your query must contain "java with" something like "+java +with developer programmer" should work. 所以假设你的查询必须包含“java with”之类的东西,比如“+ java + with developer programmer”应该可行。

The mm is used to set the number of optional clauses that must match. mm用于设置必须匹配的可选子句的数量。 Default is 100%, so this will probably need some tweaking to give the result you want. 默认值为100%,因此可能需要进行一些调整才能得到您想要的结果。 There are some examples to be found here 有一些例子可以找到这里

You have to understand that dismax is not designed to handle such queries. 您必须了解dismax不是为处理此类查询而设计的。 Dismax supports a simplified version of the Lucene QueryParser syntax. Dismax支持Lucene QueryParser语法的简化版本。 When using it, it allows the users only to provide keywords and not to bother with syntax. 使用它时,它只允许用户提供关键字,而不是打扰语法。

You can find more details about dismax here . 您可以在此处找到有关dismax的更多详细信息 Pay attention to the part about the mm parameter that allows to simulate boolean queries with dismax. 请注意有关mm参数的部分,该部分允许使用dismax模拟布尔查询。

This maybe a little off topic but it seems here that the programmer and developer words are synonyms and best if placed in the synonyms file, effectively neutralizing the need for a "programmer or developer" type of statement. 这可能有点偏离主题但似乎在这里程序员和开发人员的单词是同义词,如果放在同义词文件中最好,有效地中和了对“程序员或开发人员”类型语句的需要。 Otherwise, tweaking the minimum should match is the closest thing. 否则,调整最小值应匹配是最接近的事情。 The best route to go would be to switch to a new version of solr with EDISMAX since that'll support the standard and dismax syntax. 最好的方法是使用EDISMAX切换到新版本的solr,因为它支持标准和dismax语法。

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

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