FAQ
I have a BooleanQuery that looks like this:



BooleanQuery query = new BooleanQuery();



TermQuery term1 = new TermQuery(new Term(ID, "1234"));

TermQuery term2 = new TermQuery(new Term(ID, "2344"));

TermQuery term2 = new TermQuery(new Term(ID, "2323"));

TermQuery termLocation = new TermQuery(new Term(LOCATION, "A1"));

TermQuery termLanguage = new TermQuery(new Term(LANGUAGE, "ENU"));



query.add(term1, BooleanClause.Occur.Should);

query.add(term2, BooleanClause.Occur.Should);

query.add(term3, BooleanClause.Occur.Should);

query.add(termLocation, BooleanClause.Occur.MUST);

query.add(termLanguage, BooleanClause.Occur.MUST);



It produces this:



ID: 1234 ID:2344 ID:2323 +LOCATION:A1 +LANGUAGE:ENU



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.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 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