lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gol...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/search PhraseScorer.java
Date Wed, 07 Apr 2004 16:40:34 GMT
goller      2004/04/07 09:40:34

  Modified:    src/java/org/apache/lucene/search PhraseScorer.java
  Log:
  skipTo jumped one document too far
  
  Revision  Changes    Path
  1.12      +11 -11    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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PhraseScorer.java	29 Mar 2004 22:48:03 -0000	1.11
  +++ PhraseScorer.java	7 Apr 2004 16:40:34 -0000	1.12
  @@ -58,7 +58,7 @@
   
     public boolean next() throws IOException {
       if (firstTime) {
  -      sort();
  +      init();
         firstTime = false;
       } else if (more) {
         more = last.next();                         // trigger further scanning
  @@ -97,19 +97,19 @@
       return more;
     }
   
  -
     protected abstract float phraseFreq() throws IOException;
   
  -  private void sort() throws IOException {
  -    pq.clear();
  -    for (PhrasePositions pp = first; more && pp != null; pp = pp.next) {
  +  private void init() throws IOException {
  +    for (PhrasePositions pp = first; more && pp != null; pp = pp.next) 
         more = pp.next();
  -      if (more) {
  -        pq.put(pp);
  -      } else {
  -        return;
  -      }
  -    }
  +    if(more)
  +      sort();
  +  }
  +  
  +  private void sort() {
  +    pq.clear();
  +    for (PhrasePositions pp = first; pp != null; pp = pp.next)
  +      pq.put(pp);
       pqToList();
     }
   
  
  
  

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