Solr/Lucene is ignoring proximity search when grouped with a nested query

拟墨画扇 提交于 2019-12-12 10:27:04

问题


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.

来源:https://stackoverflow.com/questions/54575670/solr-lucene-is-ignoring-proximity-search-when-grouped-with-a-nested-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!