public NodePhraseWeight(final IndexSearcher searcher) throws IOException {
this.similarity = searcher.getSimilarity();
final IndexReaderContext context = searcher.getTopReaderContext();
states = new TermContext[terms.size()];
final TermStatistics termStats[] = new TermStatistics[terms.size()];
for (int i = 0; i < terms.size(); i++) {
final Term term = terms.get(i);
states[i] = TermContext.build(context, term, true);
termStats[i] = searcher.termStatistics(term, states[i]);
}