lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Pannell <steven.pann...@zooplus.com>
Subject Boolean Query
Date Wed, 28 Dec 2005 16:48:50 GMT
Hi,

I want to create a boolean query like:

'book' AND ( 'fred' OR 'ginger')

Anyone know how I can do the above in a BooleanQuery.  I tried this:

but it does not work.

        TermQuery t1 = new TermQuery(new Term("type","book"));
        TermQuery t2 = new TermQuery(new Term("author","fred"));
        TermQuery t3 = new TermQuery(new Term("title","ginger"));

        BooleanQuery q = new BooleanQuery();
        q.add(t3,false,false);
        q.add(t2,false,false);
        q.add(t1,true,false);


thx.
Steve.



---------------------------------------------------------------------
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