org.apache.lucene.spatial.bbox

## Class BBoxSimilarityValueSource

- java.lang.Object
- - org.apache.lucene.search.DoubleValuesSource
  - - org.apache.lucene.spatial.bbox.BBoxSimilarityValueSource

- All Implemented Interfaces:
    SegmentCacheable
  Direct Known Subclasses:
    BBoxOverlapRatioValueSource

      public abstract class BBoxSimilarityValueSource
      extends DoubleValuesSource

  A base class for calculating a spatial relevance rank per document from a provided `ShapeValuesSource` returning a `Rectangle` per-document.

  Implementers: remember to implement equals and hashCode if you have fields!

  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.search.DoubleValuesSource

      `SCORES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BBoxSimilarityValueSource(ShapeValuesSource bboxValueSource)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `Explanation` | `explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation)`
    `DoubleValues` | `getValues(LeafReaderContext readerContext, DoubleValues scores)`
    `int` | `hashCode()`
    `boolean` | `isCacheable(LeafReaderContext ctx)`
    `boolean` | `needsScores()`
    `DoubleValuesSource` | `rewrite(IndexSearcher searcher)`
    `protected abstract double` | `score(org.locationtech.spatial4j.shape.Rectangle rect, AtomicReference<Explanation> exp)` Return a relevancy score.
    `protected abstract String` | `similarityDescription()` A comma-separated list of configurable items of the subclass to put into `toString()`.
    `String` | `toString()`

    - ### Methods inherited from class org.apache.lucene.search.DoubleValuesSource

      `constant, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, toLongValuesSource`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### BBoxSimilarityValueSource

          public BBoxSimilarityValueSource(ShapeValuesSource bboxValueSource)

  - ### Method Detail

    - #### rewrite

          public DoubleValuesSource rewrite(IndexSearcher searcher)
                                     throws IOException

      Specified by:
        `rewrite` in class `DoubleValuesSource`
      Throws:
        `IOException`

    - #### toString

          public String toString()

      Specified by:
        `toString` in class `DoubleValuesSource`

    - #### similarityDescription

          protected abstract String similarityDescription()

      A comma-separated list of configurable items of the subclass to put into `toString()`.

    - #### getValues

          public DoubleValues getValues(LeafReaderContext readerContext,
                                        DoubleValues scores)
                                 throws IOException

      Specified by:
        `getValues` in class `DoubleValuesSource`
      Throws:
        `IOException`

    - #### score

          protected abstract double score(org.locationtech.spatial4j.shape.Rectangle rect,
                                          AtomicReference<Explanation> exp)

      Return a relevancy score. If `exp` is provided then diagnostic information is added.
      Parameters:
        `rect` - The indexed rectangle; not null.
        `exp` - Optional diagnostic holder.
      Returns:
        a score.

    - #### equals

          public boolean equals(Object o)

      Specified by:
        `equals` in class `DoubleValuesSource`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in class `DoubleValuesSource`

    - #### explain

          public Explanation explain(LeafReaderContext ctx,
                                     int docId,
                                     Explanation scoreExplanation)
                              throws IOException

      Overrides:
        `explain` in class `DoubleValuesSource`
      Throws:
        `IOException`

    - #### isCacheable

          public boolean isCacheable(LeafReaderContext ctx)

    - #### needsScores

          public boolean needsScores()

      Specified by:
        `needsScores` in class `DoubleValuesSource`

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