lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Searching on Multiple fields
Date Sun, 16 Jul 2006 14:13:02 GMT
You could always construct a BooleanQuery with all the necessary sub-clauses
on an as-needed basis. You can string the sub-clauses together in
arbitrarily complex ways. Be particularly aware that you one of the clauses
of a BooleanQuery may itself be a boolean query, so constructing something
like 'a and (b or c)' is equivalent to (fast pseudo code with parameters and
lotsa other stuff left out here)

BooleanQuery bqSub;
bqSub.add("b", SHOULD);
bqSub.add("c", SHOULD);

BooleanQuery bqTop;
bq.add(bqSub, MUST);
bq.add("a", MUST);

etc, etc, etc...

Best
Erick

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