lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/search BooleanScorer.java PhraseQuery.java PhraseScorer.java TermQuery.java TermScorer.java
Date Wed, 18 Feb 2004 18:28:31 GMT
cutting     2004/02/18 10:28:31

  Modified:    src/java/org/apache/lucene/search BooleanScorer.java
                        PhraseQuery.java PhraseScorer.java TermQuery.java
                        TermScorer.java
  Log:
  Fixed a recently introduced bug in BooleanScorer; added some toString() methods to facilitate
debugging.
  
  Revision  Changes    Path
  1.6       +16 -2     jakarta-lucene/src/java/org/apache/lucene/search/BooleanScorer.java
  
  Index: BooleanScorer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/BooleanScorer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BooleanScorer.java	15 Jan 2004 22:42:32 -0000	1.5
  +++ BooleanScorer.java	18 Feb 2004 18:28:31 -0000	1.6
  @@ -130,7 +130,7 @@
     public int doc() { return current.doc; }
   
     public boolean next() throws IOException {
  -    boolean more = false;
  +    boolean more;
       do {
         while (bucketTable.first != null) {         // more queued
           current = bucketTable.first;
  @@ -144,6 +144,7 @@
         }
   
         // refill the queue
  +      more = false;
         end += BucketTable.SIZE;
         for (SubScorer sub = scorers; sub != null; sub = sub.next) {
           Scorer scorer = sub.scorer;
  @@ -152,10 +153,11 @@
             sub.done = !scorer.next();
           }
           if (!sub.done) {
  -          more  = true;
  +          more = true;
           }
         }
       } while (bucketTable.first != null | more);
  +
       return false;
     }
   
  @@ -246,5 +248,17 @@
     public Explanation explain(int doc) throws IOException {
       throw new UnsupportedOperationException();
     }
  +
  +  public String toString() {
  +    StringBuffer buffer = new StringBuffer();
  +    buffer.append("boolean(");
  +    for (SubScorer sub = scorers; sub != null; sub = sub.next) {
  +      buffer.append(sub.scorer.toString());
  +      buffer.append(" ");
  +    }
  +    buffer.append(")");
  +    return buffer.toString();
  +  }
  +
   
   }
  
  
  
  1.14      +2 -0      jakarta-lucene/src/java/org/apache/lucene/search/PhraseQuery.java
  
  Index: PhraseQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/PhraseQuery.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- PhraseQuery.java	6 Feb 2004 19:19:20 -0000	1.13
  +++ PhraseQuery.java	18 Feb 2004 18:28:31 -0000	1.14
  @@ -117,6 +117,8 @@
         this.searcher = searcher;
       }
   
  +    public String toString() { return "weight(" + PhraseQuery.this + ")"; }
  +
       public Query getQuery() { return PhraseQuery.this; }
       public float getValue() { return value; }
   
  
  
  
  1.10      +2 -0      jakarta-lucene/src/java/org/apache/lucene/search/PhraseScorer.java
  
  Index: PhraseScorer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/PhraseScorer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PhraseScorer.java	15 Jan 2004 22:42:32 -0000	1.9
  +++ PhraseScorer.java	18 Feb 2004 18:28:31 -0000	1.10
  @@ -183,4 +183,6 @@
       return tfExplanation;
     }
   
  +  public String toString() { return "scorer(" + weight + ")"; }
  +
   }
  
  
  
  1.10      +2 -0      jakarta-lucene/src/java/org/apache/lucene/search/TermQuery.java
  
  Index: TermQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/TermQuery.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TermQuery.java	6 Feb 2004 19:19:20 -0000	1.9
  +++ TermQuery.java	18 Feb 2004 18:28:31 -0000	1.10
  @@ -76,6 +76,8 @@
         this.searcher = searcher;
       }
   
  +    public String toString() { return "weight(" + TermQuery.this + ")"; }
  +
       public Query getQuery() { return TermQuery.this; }
       public float getValue() { return value; }
   
  
  
  
  1.8       +3 -0      jakarta-lucene/src/java/org/apache/lucene/search/TermScorer.java
  
  Index: TermScorer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/TermScorer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TermScorer.java	15 Jan 2004 22:42:32 -0000	1.7
  +++ TermScorer.java	18 Feb 2004 18:28:31 -0000	1.8
  @@ -157,4 +157,7 @@
       
       return tfExplanation;
     }
  +
  +  public String toString() { return "scorer(" + weight + ")"; }
  +
   }
  
  
  

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


Mime
View raw message