lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <ysee...@gmail.com>
Subject Re: MatchAllDocsQuery with BooleanClause.Occur.MUST_NOT
Date Tue, 20 Dec 2005 17:51:47 GMT
I'm not sure I understand the purpose of the double negatives.
Also, a boolean query must have some non-prohibited clauses to match
anything (and mydocs in your code example violates this).

Is the following what you are trying to do?

BooleanQuery mbq = new BooleanQuery();
TermQuery mydocs = body:darpa query;
MatchAllDocsQuery alldocs = new MatchAllDocsQuery();
mbq.add(mydocs , BooleanClause.Occur.MUST_NOT);
mbq.add(alld, BooleanClause.Occur.MUST);

-Yonik


On 12/20/05, javier muguruza <jmuguruza@gmail.com> wrote:
> Hi,
>
> If I run a query like this:
> -(-body:angel) -(-body:darpa)
> I get 0 hits. As I did not find any thread about that case, I though
> ANDing with a MatchAllDocsQuery would return my desired set (all docs
> excepting the ones with angel or darpa).
>
> So more I do the following:
> BooleanQuery mbq = new BooleanQuery();
> BooleanQuery mydocs = -body:darpa query;
> MatchAllDocsQuery alldocs = new MatchAllDocsQuery();
> mbq.add(mydocs , BooleanClause.Occur.MUST_NOT);
> mbq.add(alld, BooleanClause.Occur.MUST);
>
> and I still get 0 hits, if I only add the alldocs query I get some
> hits, does anyone see something wrong with my approach?
>
> javier

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message