FAQ
That worked... thanks!

-----Original Message-----
From: Michael D. Curtin
Sent: Thursday, July 06, 2006 1:04 PM
To: java-user@lucene.apache.org
Subject: Re: BooleanQuery question

Van Nguyen wrote:
I just want results that have:

ID: 1234 OR 2344 OR 2323

LOCATION: A1

LANGUAGE: ENU

This query returns everything from my index. How would I create a query
that will only return results the must have LOCATION and LANGUAGE and
have only those three IDs.
I think you'll need to put the three ID-based TermQuerys into a
sub-BooleanQuery instead of the top-level query. Something like this:

BooleanQuery subquery = new BooleanQuery();
subquery.add(term1, BooleanClause.Occur.Should);
subquery.add(term2, BooleanClause.Occur.Should);
subquery.add(term3, BooleanClause.Occur.Should);
query.add(subquery, BooleanClause.Occur.MUST);

Good luck!

--MDC

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

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

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 10 | next ›
Discussion Overview
groupjava-user @
categorieslucene
postedJul 6, '06 at 7:53p
activeJul 22, '06 at 8:16a
posts10
users6
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase