org.apache.lucene.search.similarities

## Class BasicStats

- java.lang.Object
- - org.apache.lucene.search.similarities.Similarity.SimWeight
  - - org.apache.lucene.search.similarities.BasicStats

- Direct Known Subclasses:
    LMSimilarity.LMStats

      public class BasicStats
      extends Similarity.SimWeight

  Stores all statistics commonly used ranking methods.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected float` | `avgFieldLength` The average field length.
    `protected float` | `boost` A query boost.
    `protected long` | `docFreq` The document frequency.
    `protected long` | `numberOfDocuments` The number of documents.
    `protected long` | `numberOfFieldTokens` The total number of tokens in the field.
    `protected long` | `totalTermFreq` The total number of occurrences of this term across all documents.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicStats(String field, float boost)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `float` | `getAvgFieldLength()` Returns the average field length.
    `float` | `getBoost()` Returns the total boost.
    `long` | `getDocFreq()` Returns the document frequency.
    `long` | `getNumberOfDocuments()` Returns the number of documents.
    `long` | `getNumberOfFieldTokens()` Returns the total number of tokens in the field.
    `long` | `getTotalTermFreq()` Returns the total number of occurrences of this term across all documents.
    `void` | `setAvgFieldLength(float avgFieldLength)` Sets the average field length.
    `void` | `setDocFreq(long docFreq)` Sets the document frequency.
    `void` | `setNumberOfDocuments(long numberOfDocuments)` Sets the number of documents.
    `void` | `setNumberOfFieldTokens(long numberOfFieldTokens)` Sets the total number of tokens in the field.
    `void` | `setTotalTermFreq(long totalTermFreq)` Sets the total number of occurrences of this term across all documents.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### numberOfDocuments

          protected long numberOfDocuments

      The number of documents.

    - #### numberOfFieldTokens

          protected long numberOfFieldTokens

      The total number of tokens in the field.

    - #### avgFieldLength

          protected float avgFieldLength

      The average field length.

    - #### docFreq

          protected long docFreq

      The document frequency.

    - #### totalTermFreq

          protected long totalTermFreq

      The total number of occurrences of this term across all documents.

    - #### boost

          protected final float boost

      A query boost. Should be applied as a multiplicative factor to the score.

  - ### Constructor Detail

    - #### BasicStats

          public BasicStats(String field,
                            float boost)

      Constructor.

  - ### Method Detail

    - #### getNumberOfDocuments

          public long getNumberOfDocuments()

      Returns the number of documents.

    - #### setNumberOfDocuments

          public void setNumberOfDocuments(long numberOfDocuments)

      Sets the number of documents.

    - #### getNumberOfFieldTokens

          public long getNumberOfFieldTokens()

      Returns the total number of tokens in the field.
      See Also:
        `Terms.getSumTotalTermFreq()`

    - #### setNumberOfFieldTokens

          public void setNumberOfFieldTokens(long numberOfFieldTokens)

      Sets the total number of tokens in the field.
      See Also:
        `Terms.getSumTotalTermFreq()`

    - #### getAvgFieldLength

          public float getAvgFieldLength()

      Returns the average field length.

    - #### setAvgFieldLength

          public void setAvgFieldLength(float avgFieldLength)

      Sets the average field length.

    - #### getDocFreq

          public long getDocFreq()

      Returns the document frequency.

    - #### setDocFreq

          public void setDocFreq(long docFreq)

      Sets the document frequency.

    - #### getTotalTermFreq

          public long getTotalTermFreq()

      Returns the total number of occurrences of this term across all documents.

    - #### setTotalTermFreq

          public void setTotalTermFreq(long totalTermFreq)

      Sets the total number of occurrences of this term across all documents.

    - #### getBoost

          public float getBoost()

      Returns the total boost.

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.