gate.creole.annic.apache.lucene.search
Class PhraseScorer

java.lang.Object
  extended by gate.creole.annic.apache.lucene.search.Scorer
      extended by gate.creole.annic.apache.lucene.search.PhraseScorer
Direct Known Subclasses:
ExactPhraseScorer, SloppyPhraseScorer

abstract class PhraseScorer
extends Scorer


Field Summary
protected  PhrasePositions first
           
private  boolean firstTime
           
private  float freq
           
protected  PhrasePositions last
           
private  boolean more
           
protected  byte[] norms
           
protected  PhraseQueue pq
           
protected  float value
           
private  Weight weight
           
 
Fields inherited from class gate.creole.annic.apache.lucene.search.Scorer
searcher
 
Constructor Summary
PhraseScorer(Weight weight, TermPositions[] tps, Similarity similarity, byte[] norms)
           
PhraseScorer(Weight weight, TermPositions[] tps, Vector positions, Similarity similarity, byte[] norms, Searcher searcher)
           
 
Method Summary
 int doc()
          Returns the current document number.
private  boolean doNext()
           
 Explanation explain(int doc)
          Returns an explanation of the score for doc.
protected  void firstToLast()
           
private  void init()
           
 boolean next(Searcher searcher)
          Advance to the next document matching the query.
protected abstract  float phraseFreq()
           
protected  void pqToList()
           
 float score(Searcher searcher)
          Returns the score of the current document.
 boolean skipTo(int target)
          Skips to the first match beyond the current whose document number is greater than or equal to target.
private  void sort()
           
 String toString()
           
 
Methods inherited from class gate.creole.annic.apache.lucene.search.Scorer
getSimilarity, score
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

weight

private Weight weight

norms

protected byte[] norms

value

protected float value

firstTime

private boolean firstTime

more

private boolean more

pq

protected PhraseQueue pq

first

protected PhrasePositions first

last

protected PhrasePositions last

freq

private float freq
Constructor Detail

PhraseScorer

PhraseScorer(Weight weight,
             TermPositions[] tps,
             Vector positions,
             Similarity similarity,
             byte[] norms,
             Searcher searcher)
       throws IOException
Throws:
IOException

PhraseScorer

PhraseScorer(Weight weight,
             TermPositions[] tps,
             Similarity similarity,
             byte[] norms)
       throws IOException
Throws:
IOException
Method Detail

doc

public int doc()
Description copied from class: Scorer
Returns the current document number. Initially invalid, until #next() is called the first time.

Specified by:
doc in class Scorer

next

public boolean next(Searcher searcher)
             throws IOException
Description copied from class: Scorer
Advance to the next document matching the query. Returns true iff there is another match.

Specified by:
next in class Scorer
Throws:
IOException

doNext

private boolean doNext()
                throws IOException
Throws:
IOException

score

public float score(Searcher searcher)
            throws IOException
Description copied from class: Scorer
Returns the score of the current document. Initially invalid, until #next() is called the first time.

Specified by:
score in class Scorer
Throws:
IOException

skipTo

public boolean skipTo(int target)
               throws IOException
Description copied from class: Scorer
Skips to the first match beyond the current whose document number is greater than or equal to target.

Returns true iff there is such a match.

Behaves as if written:

   boolean skipTo(int target) {
     do {
       if (!next())
             return false;
     } while (target > doc());
     return true;
   }
 
Most implementations are considerably more efficient than that.

Specified by:
skipTo in class Scorer
Throws:
IOException

phraseFreq

protected abstract float phraseFreq()
                             throws IOException
Throws:
IOException

init

private void init()
           throws IOException
Throws:
IOException

sort

private void sort()

pqToList

protected final void pqToList()

firstToLast

protected final void firstToLast()

explain

public Explanation explain(int doc)
                    throws IOException
Description copied from class: Scorer
Returns an explanation of the score for doc.

Specified by:
explain in class Scorer
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object