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

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

Introduction

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

Prototype

public long getNumberOfDocuments() 

Source Link

Document

Returns the number of documents.

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;
}