org.apache.lucene.spatial.bbox

## Class BBoxSimilarityValueSource

- java.lang.Object
- - org.apache.lucene.queries.function.ValueSource
  - - org.apache.lucene.spatial.bbox.BBoxSimilarityValueSource

- Direct Known Subclasses:
    BBoxOverlapRatioValueSource

      public abstract class BBoxSimilarityValueSource
      extends ValueSource

  A base class for calculating a spatial relevance rank per document from a provided `ValueSource` in which `FunctionValues.objectVal(int)` returns a `Rectangle`.

  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.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BBoxSimilarityValueSource(ValueSource bboxValueSource)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `createWeight(Map context, IndexSearcher searcher)`
    `String` | `description()`
    `boolean` | `equals(Object o)`
    `FunctionValues` | `getValues(Map context, LeafReaderContext readerContext)`
    `int` | `hashCode()`
    `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 `description()`.

    - ### Methods inherited from class org.apache.lucene.queries.function.ValueSource

      `asDoubleValuesSource, asLongValuesSource, getSortField, newContext, toString`

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

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

- - ### Constructor Detail

    - #### BBoxSimilarityValueSource

          public BBoxSimilarityValueSource(ValueSource bboxValueSource)

  - ### Method Detail

    - #### createWeight

          public void createWeight(Map context,
                                   IndexSearcher searcher)
                            throws IOException

      Overrides:
        `createWeight` in class `ValueSource`
      Throws:
        `IOException`

    - #### description

          public String description()

      Specified by:
        `description` in class `ValueSource`

    - #### similarityDescription

          protected abstract String similarityDescription()

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

    - #### getValues

          public FunctionValues getValues(Map context,
                                          LeafReaderContext readerContext)
                                   throws IOException

      Specified by:
        `getValues` in class `ValueSource`
      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 `ValueSource`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in class `ValueSource`

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