public class CollectionStatistics
extends java.lang.Object
This class holds statistics across all documents for scoring purposes:
maxDoc()
: number of documents.
docCount()
: number of documents that contain this field.
sumDocFreq()
: number of postings-list entries.
sumTotalTermFreq()
: number of tokens.
The following conditions are always true:
docCount
<= maxDoc
docCount
<= sumDocFreq
<= sumTotalTermFreq
Values may include statistics on deleted documents that have not yet been merged away.
Be careful when performing calculations on these values because they are represented
as 64-bit integer values, you may need to cast to double
for your use.
Modifier and Type | Field and Description |
---|---|
private long |
docCount |
private java.lang.String |
field |
private long |
maxDoc |
private long |
sumDocFreq |
private long |
sumTotalTermFreq |
Constructor and Description |
---|
CollectionStatistics(java.lang.String field,
long maxDoc,
long docCount,
long sumTotalTermFreq,
long sumDocFreq)
Creates statistics instance for a collection (field).
|
Modifier and Type | Method and Description |
---|---|
long |
docCount()
The total number of documents that have at least
one term for this field.
|
java.lang.String |
field()
The field's name.
|
long |
maxDoc()
The total number of documents, regardless of
whether they all contain values for this field.
|
long |
sumDocFreq()
The total number of posting list entries for this field.
|
long |
sumTotalTermFreq()
The total number of tokens for this field.
|
java.lang.String |
toString() |
private final java.lang.String field
private final long maxDoc
private final long docCount
private final long sumTotalTermFreq
private final long sumDocFreq
public CollectionStatistics(java.lang.String field, long maxDoc, long docCount, long sumTotalTermFreq, long sumDocFreq)
field
- Field's namemaxDoc
- total number of documents.docCount
- number of documents containing the field.sumTotalTermFreq
- number of tokens in the field.sumDocFreq
- number of postings list entries for the field.java.lang.IllegalArgumentException
- if maxDoc
is negative or zero.java.lang.IllegalArgumentException
- if docCount
is negative or zero.java.lang.IllegalArgumentException
- if docCount
is more than maxDoc
.java.lang.IllegalArgumentException
- if sumDocFreq
is less than docCount
.java.lang.IllegalArgumentException
- if sumTotalTermFreq
is less than sumDocFreq
.public final java.lang.String field()
This value is never null
.
null
public final long maxDoc()
This value is always a positive number.
Long.MAX_VALUE
]IndexReader.maxDoc()
public final long docCount()
This value is always a positive number, and never
exceeds maxDoc()
.
maxDoc()
]Terms.getDocCount()
public final long sumTotalTermFreq()
TermStatistics.totalTermFreq()
across all terms.
It is also the sum of each document's field length across all documents.
This value is always a positive number, and always at least sumDocFreq()
.
sumDocFreq()
.. Long.MAX_VALUE
]Terms.getSumTotalTermFreq()
public final long sumDocFreq()
TermStatistics.docFreq()
across all terms.
It is also the sum of each document's unique term count for this field across all documents.
This value is always a positive number, always at least docCount()
, and never
exceeds sumTotalTermFreq()
.
docCount()
.. sumTotalTermFreq()
]Terms.getSumDocFreq()
public java.lang.String toString()
toString
in class java.lang.Object