lucene-java-user mailing list archives

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

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message