Record Class CollectionStatistics
- Record Components:
field
- Field's name.This value is never
null
.maxDoc
- The total number of documents in the range [1 ..Long.MAX_VALUE
], regardless of whether they all contain values for this field.This value is always a positive number. @see IndexReader#maxDoc()
docCount
- The total number of documents that have at least one term for this field , in the range [1 ..maxDoc()
].This value is always a positive number, and never exceeds
maxDoc()
. @see Terms#getDocCount()sumTotalTermFreq
- The total number of tokens for this field , in the range [sumDocFreq()
..Long.MAX_VALUE
]. This is the "word count" for this field across all documents. It is the sum ofTermStatistics.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()
. @see Terms#getSumTotalTermFreq()sumDocFreq
- The total number of posting list entries for this field, in the range [docCount()
..sumTotalTermFreq()
]. This is the sum of term-document pairs: the sum ofTermStatistics.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 exceedssumTotalTermFreq()
. @see Terms#getSumDocFreq()
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:
- All statistics are positive integers: never zero or negative.
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.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionStatistics
(String field, long maxDoc, long docCount, long sumTotalTermFreq, long sumDocFreq) Creates statistics instance for a collection (field). -
Method Summary
Modifier and TypeMethodDescriptionlong
docCount()
Returns the value of thedocCount
record component.final boolean
Indicates whether some other object is "equal to" this one.field()
Returns the value of thefield
record component.final int
hashCode()
Returns a hash code value for this object.long
maxDoc()
Returns the value of themaxDoc
record component.long
Returns the value of thesumDocFreq
record component.long
Returns the value of thesumTotalTermFreq
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
CollectionStatistics
public CollectionStatistics(String field, long maxDoc, long docCount, long sumTotalTermFreq, long sumDocFreq) Creates statistics instance for a collection (field).- Throws:
IllegalArgumentException
- ifmaxDoc
is negative or zero.IllegalArgumentException
- ifdocCount
is negative or zero.IllegalArgumentException
- ifdocCount
is more thanmaxDoc
.IllegalArgumentException
- ifsumDocFreq
is less thandocCount
.IllegalArgumentException
- ifsumTotalTermFreq
is less thansumDocFreq
.
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
field
Returns the value of thefield
record component.- Returns:
- the value of the
field
record component
-
maxDoc
public long maxDoc()Returns the value of themaxDoc
record component.- Returns:
- the value of the
maxDoc
record component
-
docCount
public long docCount()Returns the value of thedocCount
record component.- Returns:
- the value of the
docCount
record component
-
sumTotalTermFreq
public long sumTotalTermFreq()Returns the value of thesumTotalTermFreq
record component.- Returns:
- the value of the
sumTotalTermFreq
record component
-
sumDocFreq
public long sumDocFreq()Returns the value of thesumDocFreq
record component.- Returns:
- the value of the
sumDocFreq
record component
-