public class CollectionStatistics extends 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.
| Constructor and Description |
|---|
CollectionStatistics(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.
|
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.
|
String |
toString() |
public CollectionStatistics(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.IllegalArgumentException - if maxDoc is negative or zero.IllegalArgumentException - if docCount is negative or zero.IllegalArgumentException - if docCount is more than maxDoc.IllegalArgumentException - if sumDocFreq is less than docCount.IllegalArgumentException - if sumTotalTermFreq is less than sumDocFreq.public final String field()
This value is never null.
nullpublic 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()Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.