lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Akselrod" <aaksel...@runtime.com>
Subject having problem with BooleanQuery
Date Tue, 08 Apr 2003 17:29:37 GMT
Hello,

I need to perform the follwoing search:
(search my full text fields using or condition) AND (search my category
fields using or condition)

This is what I tried to do:
BooleanQuery bQuery = new BooleanQuery();
// full text
for (int i = 0; i < fields.length; i++)
{
  Query q = QueryParser.parse(queryString, fields[i], analyzer);
  bQuery.add(q, false, false);
}
// category
if(categoryQueryString != null)
{
   BooleanQuery categoryQuery = new BooleanQuery();
   for (int i = 0; i < fieldCategories.length; i++)
   {
    Query q = QueryParser.parse(categoryQueryString, fieldCategories[i],
analyzer);
    categoryQuery.add(q, false, false);
   }
   bQuery.add(categoryQuery, false, false);
}

It does not seem to search categories. The documentation is not clear on how
to perform AND in my above condition. I tried to do
bQuery.add(categoryQuery, true, false), but then it stops returning any
results. I don't entirely understand BooleanQuery.add() function flags.

Any ideas on how to do this?

Thank you,
-a


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


Mime
View raw message