Nested BooleanQuery?

I use BooleanQuery to combine multiple queries. I find that if I add BooleanQuery to BooleanQuery, the result will not be returned. The added BooleanQuery is MUST_NOT, e.g. -city_id: 100.

But, as the lucene specification says, BooleanQuery can be nested, which, I think, means you can add such a BooleanQuery. Now I need to get all the suggestions from the added BooleanQuery, and then add them to the BooleanQuery container one by one.

I'm a little confused. Can anybody help? Thank you very much!

+1
lucene
source share
1 answer

Lucene does not support the unary NOT operator. But you can get results for such a query by specifying its MatchAllDocsQuery .

+4
source share

All Articles