org.apache.lucene.search.similarities

## Class Similarity.SloppySimScorer

- java.lang.Object
- - org.apache.lucene.search.similarities.Similarity.SloppySimScorer

- Enclosing class:
    Similarity

      public abstract static class Similarity.SloppySimScorer
      extends Object

  API for scoring "sloppy" queries such as `SpanQuery` and sloppy `PhraseQuery`.

  Frequencies are floating-point values: an approximate within-document frequency adjusted for "sloppiness" by `computeSlopFactor(int)`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Similarity.SloppySimScorer()` Sole constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract float` | `computePayloadFactor(int doc, int start, int end, BytesRef payload)` Calculate a scoring factor based on the data in the payload.
    `abstract float` | `computeSlopFactor(int distance)` Computes the amount of a sloppy phrase match, based on an edit distance.
    `Explanation` | `explain(int doc, Explanation freq)` Explain the score for a single document
    `abstract float` | `score(int doc, float freq)` Score a single document

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

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

- - ### Constructor Detail

    - #### Similarity.SloppySimScorer

          public Similarity.SloppySimScorer()

      Sole constructor. (For invocation by subclass constructors, typically implicit.)

  - ### Method Detail

    - #### score

          public abstract float score(int doc,
                    float freq)

      Score a single document
      Parameters:
        `doc` - document id within the inverted index segment
        `freq` - sloppy term frequency
      Returns:
        document's score

    - #### computeSlopFactor

          public abstract float computeSlopFactor(int distance)

      Computes the amount of a sloppy phrase match, based on an edit distance.

    - #### computePayloadFactor

          public abstract float computePayloadFactor(int doc,
                                   int start,
                                   int end,
                                   BytesRef payload)

      Calculate a scoring factor based on the data in the payload.

    - #### explain

          public Explanation explain(int doc,
                            Explanation freq)

      Explain the score for a single document
      Parameters:
        `doc` - document id within the inverted index segment
        `freq` - Explanation of how the sloppy term frequency was computed
      Returns:
        document's score

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