Mailing List Archive

Boolean Queries
I've been experimenting with boolean queries to find out their real meaning.

If you want to submit a query and would like the returned hits to be documents in which ALL the query terms appear, is it necessary to construct a boolean query adding a clause for each term in the query: booleanQuery.add(term, true, false) ?

After some experiments, it seems that the Query returned by the QueryParser given a String of query terms, is really a query that will return documents with ANY of the query terms. Can anyone tell me for sure?

Thanks,
Melissa
Re: Boolean Queries [ In reply to ]
On Fri, 2002-04-05 at 10:50, Melissa Mifsud wrote:
> I've been experimenting with boolean queries to find out their real meaning.
>
> After some experiments, it seems that the Query returned by the QueryParser
> given a String of query terms, is really a query that will return
> documents with ANY of the query terms. Can anyone tell me for sure?

Yes, that's right. You can tweak the query parser code if you want to
only return documents containing all terms.

MOD_REQ or CONJ_AND are the relevant constants in QueryParser.jj.

I think I just set the default value returned by Conjunction() to
CONJ_AND.

Hope that helps,

--
Lee Mallabone.



--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>