NodePhraseScorer(final Weight weight, final NodePhraseQuery.PostingsAndPosition[] postings, final Similarity.SloppySimScorer sloppyScorer, final Similarity.ExactSimScorer exactScorer) throws IOException { super(weight); this.sloppyScorer = sloppyScorer; this.exactScorer = exactScorer; // convert tps to a list of phrase positions. // note: phrase-position differs from term-position in that its position // reflects the phrase offset: pp.pos = tp.pos - offset. // this allows to easily identify a matching (exact) phrase // when all PhrasePositions have exactly the same position. phrasePositions = new NodePhrasePosition[postings.length]; for (int i = 0; i < postings.length; i++) { phrasePositions[i] = new NodePhrasePosition(postings[i].postings, postings[i].position); } // create node conjunction scorer final NodeScorer[] scorers = new NodeScorer[postings.length]; for (int i = 0; i < postings.length; i++) { scorers[i] = new NodeTermScorer(weight, postings[i].postings, exactScorer); } conjunctionScorer = new NodeConjunctionScorer(weight, 1.0f, scorers); }