1 package org.apache.lucene.search; 2 3 18 19 import java.io.IOException ; 20 import org.apache.lucene.index.*; 21 22 final class ExactPhraseScorer extends PhraseScorer { 23 24 ExactPhraseScorer(Weight weight, TermPositions[] tps, int[] positions, Similarity similarity, 25 byte[] norms) { 26 super(weight, tps, positions, similarity, norms); 27 } 28 29 protected final float phraseFreq() throws IOException { 30 for (PhrasePositions pp = first; pp != null; pp = pp.next) { 32 pp.firstPosition(); 33 pq.put(pp); } 35 pqToList(); 37 int freq = 0; 38 do { while (first.position < last.position) { do { 41 if (!first.nextPosition()) 42 return (float)freq; 43 } while (first.position < last.position); 44 firstToLast(); 45 } 46 freq++; } while (last.nextPosition()); 48 49 return (float)freq; 50 } 51 } 52 | Popular Tags |