Class GeohashHaversineFunction


  • public class GeohashHaversineFunction
    extends org.apache.lucene.queries.function.ValueSource
    Calculate the Haversine distance between two geo hash codes.

    Ex: ghhsin(ValueSource, ValueSource, radius)

    See Also:
    for more details on the implementation
    • Constructor Summary

      Constructors 
      Constructor Description
      GeohashHaversineFunction​(org.apache.lucene.queries.function.ValueSource geoHash1, org.apache.lucene.queries.function.ValueSource geoHash2, double radius)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void createWeight​(Map context, org.apache.lucene.search.IndexSearcher searcher)  
      String description()  
      protected double distance​(int doc, org.apache.lucene.queries.function.FunctionValues gh1DV, org.apache.lucene.queries.function.FunctionValues gh2DV)  
      boolean equals​(Object o)  
      org.apache.lucene.queries.function.FunctionValues getValues​(Map context, org.apache.lucene.index.LeafReaderContext readerContext)  
      int hashCode()  
      protected String name()  
      • Methods inherited from class org.apache.lucene.queries.function.ValueSource

        asDoubleValuesSource, asLongValuesSource, fromDoubleValuesSource, getSortField, newContext, toString
    • Constructor Detail

      • GeohashHaversineFunction

        public GeohashHaversineFunction​(org.apache.lucene.queries.function.ValueSource geoHash1,
                                        org.apache.lucene.queries.function.ValueSource geoHash2,
                                        double radius)
    • Method Detail

      • name

        protected String name()
      • getValues

        public org.apache.lucene.queries.function.FunctionValues getValues​(Map context,
                                                                           org.apache.lucene.index.LeafReaderContext readerContext)
                                                                    throws IOException
        Specified by:
        getValues in class org.apache.lucene.queries.function.ValueSource
        Throws:
        IOException
      • distance

        protected double distance​(int doc,
                                  org.apache.lucene.queries.function.FunctionValues gh1DV,
                                  org.apache.lucene.queries.function.FunctionValues gh2DV)
                           throws IOException
        Throws:
        IOException
      • createWeight

        public void createWeight​(Map context,
                                 org.apache.lucene.search.IndexSearcher searcher)
                          throws IOException
        Overrides:
        createWeight in class org.apache.lucene.queries.function.ValueSource
        Throws:
        IOException
      • equals

        public boolean equals​(Object o)
        Specified by:
        equals in class org.apache.lucene.queries.function.ValueSource
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class org.apache.lucene.queries.function.ValueSource
      • description

        public String description()
        Specified by:
        description in class org.apache.lucene.queries.function.ValueSource