Solr query with grouping not working

2019-06-14 14:12发布

The following query works fine:

q=field_one:value_one AND -field_two:[* TO *] AND -field_three:[* TO *]

However, as soon as I put brackets in there I get no results

q=field_one:value_one AND (-field_two:[* TO *] AND -field_three:[* TO *])

Aren't these two queries equivalent?

Thanks all

Dave

NB: I'm doing this as I need to combine more 'AND's with 'OR's; rather than just because I like brackets.

标签: solr lucene
1条回答
Anthone
2楼-- · 2019-06-14 14:48

Swapping the boolean around a bit I have something that works.

q=field_one:value_one AND -(field_two:[* TO *] OR field_three:[* TO *])

gives the same results as the original query with no brackets.

No idea why Solr is so picky about the other syntax though. Seems a little bizarre to me.

查看更多
登录 后发表回答