Solr edismax parser and multiple fields search

时间:2015-11-12 10:57:29

标签: search solr edismax dismax

I use the edismax query parser to handle user queries against our Solr 4.10.3 server.

I configured the q.op parameter to AND and completely disabled the mm parameter in order to hit only 100% matches.

When users search for multiple terms in a single field everything works fine.

For example the query food:(beer cola pizza) returns only those documents that contains all of the terms beer, cola and pizza in the field food which is the expected behaviour.

But when users search in multiple fields Solr seems to forget about the q.op configuration and behaves as if the parameter was set to OR.

For example the query food:(beer cola pizza) AND color:(green yellow blue) returns all those documents that contains one of the terms beer, cola OR pizza in the field food and those that contains one of the terms green, yellow OR blue in the field color which isn't the expected behaviour.

A workaround is to explicitely prepare each term with the + operator just like this: food:(+beer +cola +pizza) AND color:(+green +yellow +blue).

But I need to add this operator in our java-webapplication which is kind of a 'hard code' feature. When users decide to configure the q.op operator back to OR the hard coded + would cause problems I think.

Is there a way to reach the expected search results by configuration?

0 个答案:

没有答案