Example usage for org.apache.lucene.search.similarities BasicStats getDocFreq

List of usage examples for org.apache.lucene.search.similarities BasicStats getDocFreq

Introduction

In this page you can find the example usage for org.apache.lucene.search.similarities BasicStats getDocFreq.

Prototype

public long getDocFreq() 

Source Link

Document

Returns the document frequency.

Usage

From source file:simfunctions.GeneralizedTfIdfSimilarity.java

@Override
protected float score(BasicStats stats, float freq, float docLen) {
    // Return the tf-idf score (the tf being a generalized one obtained
    // from the Bezier curve)
    //float tf = tfFunc.getTFScore(freq/stats.getAvgFieldLength()); // docLen
    float tf = tfFunc.getTFScore(freq); // docLen
    float idf = (float) Math.log(stats.getNumberOfDocuments() / (double) stats.getDocFreq());
    return stats.getTotalBoost() * tf * idf;
}