lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Melissa Mifsud" <>
Subject "Match All Words" Query
Date Sat, 06 Apr 2002 16:16:52 GMT

I've been going round in circles trying to come up with a query that will return documents
which contian ALL the query terms. This should be easy, however I would like the words to
span ANY of the fields of the documents.

If the BooleanQuery(ies) do actually follow boolean logic, then I should be able to form this

BooleanQuery b = new BooleanQuery();

for each term in the query {
    BooleanQuery sub_query = new BooleanQuery();
    for each field {
        Query q = QueryParser.parse(term,field,analyzer);
        sub_query.add(q,false,false);                              <---- disjunction of

    b.add(sub_query,true,false); <---- conjunction of terms

And then b *should* be the query.

However, the query does not give the desired results!

Probably most all users of Lucene have needed such a query... I feel i'm complicating things

Help would be greatly appreciated.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message