lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Serebrennikov <dmit...@earthlink.net>
Subject cleaned up legacy code in BooleanQuery
Date Mon, 08 Oct 2001 00:09:40 GMT
The mask logic in the BooleanQuery.scorer is no longer needed because it 
has moved to the BooleanScorer.add.
Besides, the 32-clause limitation may need to go in the future and it 
would be simpler to fix it in one place.
Here's the diff:

Index: java/org/apache/lucene/search/BooleanQuery.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/search/BooleanQuery.java,v
retrieving revision 1.1.1.1
diff -B -r1.1.1.1 BooleanQuery.java
130d129
<     int theMask = 1, thisMask;
132,143c131,136
<       BooleanClause c = (BooleanClause)clauses.elementAt(i);
<       if (c.required || c.prohibited) {
<       thisMask = theMask;
<       theMask = theMask << 1;
<       } else
<       thisMask = 0;
<
<       Scorer subScorer = c.query.scorer(reader);
<       if (subScorer != null)
<       result.add(subScorer, c.required, c.prohibited);
<       else if (c.required)
<       return null;
---
 >         BooleanClause c = (BooleanClause)clauses.elementAt(i);
 >         Scorer subScorer = c.query.scorer(reader);
 >         if (subScorer != null)
 >             result.add(subScorer, c.required, c.prohibited);
 >         else if (c.required)
 >               return null;
145,147d137
<     if (theMask == 0)
<       throw new IndexOutOfBoundsException
<       ("More than 32 required/prohibited clauses in query.");



Mime
View raw message