Package org.apache.lucene.search

Examples of org.apache.lucene.search.TermStatistics


    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]);
      }
View Full Code Here


  private CollectionStatistics toCollectionStats(BasicStats stats) {
    return new CollectionStatistics(stats.field, stats.getNumberOfDocuments(), -1, stats.getNumberOfFieldTokens(), -1);
  }
 
  private TermStatistics toTermStats(BasicStats stats) {
    return new TermStatistics(new BytesRef("spoofyText"), stats.getDocFreq(), stats.getTotalTermFreq());
  }
View Full Code Here

  private CollectionStatistics toCollectionStats(BasicStats stats) {
    return new CollectionStatistics(stats.field, stats.getNumberOfDocuments(), -1, stats.getNumberOfFieldTokens(), -1);
  }
 
  private TermStatistics toTermStats(BasicStats stats) {
    return new TermStatistics(new BytesRef("spoofyText"), stats.getDocFreq(), stats.getTotalTermFreq());
  }
View Full Code Here

  private CollectionStatistics toCollectionStats(BasicStats stats) {
    return new CollectionStatistics(stats.field, stats.getNumberOfDocuments(), -1, stats.getNumberOfFieldTokens(), -1);
  }
 
  private TermStatistics toTermStats(BasicStats stats) {
    return new TermStatistics(new BytesRef("spoofyText"), stats.getDocFreq(), stats.getTotalTermFreq());
  }
View Full Code Here

            for (int i = 0; i < termStatistics.length; i++) {
                BytesRef term = terms[i].bytes();
                final long docFreq = in.readVLong();
                assert docFreq >= 0;
                final long totalTermFreq = subOne(in.readVLong());
                termStatistics[i] = new TermStatistics(term, docFreq, totalTermFreq);
            }
        }
        return termStatistics;
    }
View Full Code Here

    public void readFrom(StreamInput in) throws IOException {
        int size = in.readVInt();
        termStatistics = HppcMaps.newMap(size);
        for (int i = 0; i < size; i++) {
            Term term = new Term(in.readString(), in.readBytesRef());
            TermStatistics stats = new TermStatistics(in.readBytesRef(),
                    in.readVLong(),
                    DfsSearchResult.subOne(in.readVLong()));
            termStatistics.put(term, stats);
        }
        fieldStatistics = DfsSearchResult.readFieldStats(in);
View Full Code Here

        for (int i = 0; i < states.length; i++) {
            if (states[i]) {
                Term term = (Term) keys[i];
                out.writeString(term.field());
                out.writeBytesRef(term.bytes());
                TermStatistics stats = (TermStatistics) values[i];
                out.writeBytesRef(stats.term());
                out.writeVLong(stats.docFreq());
                out.writeVLong(DfsSearchResult.addOne(stats.totalTermFreq()));
            }
        }
        DfsSearchResult.writeFieldStats(out, fieldStatistics);
        out.writeVLong(maxDoc);
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.TermStatistics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.