문제

I'm having a problem using the Solr ExtendedDisMax Query Parser with query that contains fielded searches inside not-plain queries.

The case is the following.

If I send to SOLR an edismax request (defType=edismax) with parameters

  1. qf=field1^10
  2. q=field2:ciao
  3. debugQuery=on (for debug purposes)

solr parses the query as I expect, in fact the debug part of the response tells me that

 [parsedquery_toString] => +field2:ciao

But if I make the expression only a bit more complex, like putting the condition into brackets: 1. qf=field1^10 2. q=(field2:ciao) I get

[parsedquery_toString] => +(((field1:field2:^2.0) (field1:ciao^2.0))~2)

where Solr seems not recognize the field syntax.

I've not found any mention to this behavior in the documentation, where instead they say that

This parser supports full Lucene QueryParser syntax including boolean operators 'AND', 'OR', 'NOT', '+' and '-', fielded search, term boosting, fuzzy...

This problem is really annoying me because I would like to do compelx boolean and fielded queries even with the edismax parser.

Do you know a way to workaround this?

EDIT: The Solr version is 3.6

도움이 되었습니까?

해결책

If you are using Solr 3.6, there is a current issue with eDisMax and Fielded searches that was introduced with Solr 3.6. The workaround is to precede the field name with a space.

So change your query to the following:

  1. qf=field1^10
  2. q=( field2:ciao)

Please see eDismax: A fielded query wrapped by parens is not recognized for the more details.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top