Examples of idf()


Examples of org.apache.lucene.search.Similarity.idf()

      Term term = new Term(Field.CONTENTS.toString(), termText);
     
      float termFreq = sim.tf( termFrequencies[i] );

      int docFreq = reader.docFreq(term);
      float idf = sim.idf(docFreq, numDocs);

      float tfIdf = termFreq * idf;

      scores[i] = tfIdf;
    }
View Full Code Here

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.