I'm encountering some confusing behaviour with solr queries (technically the Lucene parsing) which can be simplified down to a query like the following:
_query_:"foo:\"a b\"~3" AND foo:"c d"~6
Using the debugQuery
option I can see this is parsed as:
+PhraseQuery(foo:\"a b\"~3) +PhraseQuery(foo:\"c d\")
or as parsedquery_toString, +foo:\"a b\"~3 +foo:\"c d\"
What has happened to the proximity of ~6 from the right hand side of the query? This only appears to happen when combining a nested query with a non-nested query as in the example above.
By comparison, by not using a nested query and writing
foo:"a b"~3 AND foo:"c d"~6
Gets correctly parsed as
+PhraseQuery(foo:\"a b\"~3) +PhraseQuery(foo:\"c d\"~6)
or as parsedquery_toString, +foo:\"a b\"~3 +foo:\"c d\"~6
Or alternatively using two nested queries as in:
_query_:"foo:\"a b\"~3" AND _query_:"foo:\"c d\"~6"
Also gets parsed correctly to be identical to the query without using nested queries.
Why is the proximity search of ~6 being dropped in the first example?
I am running Solr version 4.10.3 but have upgraded to 7.5.0 and I'm finding the same behaviour.