lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael D. Curtin" <>
Subject Re: Question to Lucene Index
Date Fri, 24 Feb 2006 13:52:00 GMT
Volodymyr Bychkoviak wrote:

> This is not the case.
> maxClauseCount limit number of terms that can fit into BooleanQuery 
> during some queries rewriting. And default value is 1024, not 32.
> 32 required/prohibited clauses is limitation of Lucene 1.4.3 due to 
> usage of bit patterns to mask required/prohibited clauses.
> You can solve this problem by using Lucene 1.9 RC or use Filters.

Doh!  Wrong Exception.  Volodymyr is right.

Thomas, what do your extra clauses look like?  Can they be combined in 
sub-clauses, as it were?  For example, if you want hits with A, subject to the 
restrictions that they don't have B, nor C, ..., you might be able to use a 
query construct like

+A -(B || C || ...)

The components of the B || C || ... part aren't required nor prohibited, so 
you wouldn't run up against the 32 limit (you might hit the 1024 limit, but 
then you now know how to increase that).  If you're constructing the Query 
yourself (not via the QueryParser), then something like this:

BooleanQuery q1 = new BooleanQuery();
q1.add(new TermQuery(new Term("field", "B"), false, false);
q1.add(new TermQuery(new Term("field", "C"), false, false);
q2 = new BooleanQuery();
q2.add(new TermQuery(new Term("field", "A"), true, false);
q2.add(q1, false, true);
// Use q2 for searching

Note also that you could substitute any Query-derived object for the new 
TermQuery()s in q1.  If you need to add restrictions more complicated than a 
single value of a single field, build up another Query-derived object for that 
restriction, and put it into q1 instead.

Good luck!  (And sorry about the misdirection)


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

View raw message