简体   繁体   中英

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...

It works with solr standard handler but not with 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. So assuming your query must contain "java with" something like "+java +with developer programmer" should work.

The mm is used to set the number of optional clauses that must match. Default is 100%, so this will probably need some tweaking to give the result you want. There are some examples to be found here

You have to understand that dismax is not designed to handle such queries. Dismax supports a simplified version of the Lucene QueryParser syntax. 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 . Pay attention to the part about the mm parameter that allows to simulate boolean queries with 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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