Package org.apache.lucene.search.similarities

Examples of org.apache.lucene.search.similarities.TFIDFSimilarity.idf()


    TFIDFSimilarity sim = asTFIDF(searcher.getSimilarity(), field);
    if (sim == null) {
      throw new UnsupportedOperationException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
    }
    int docfreq = searcher.getIndexReader().docFreq(new Term(indexedField, indexedBytes));
    float idf = sim.idf(docfreq, searcher.getIndexReader().maxDoc());
    return new ConstDoubleDocValues(idf, this);
  }
 
  // tries extra hard to cast the sim to TFIDFSimilarity
  static TFIDFSimilarity asTFIDF(Similarity sim, String field) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.