Geo Distance Range Filter

edit

Geo Distance Range Filter

edit

See Geo Distance Range Filter

FilterBuilder filter = geoDistanceRangeFilter("pin.location")   
    .point(40, -70)                                             
    .from("200km")                                              
    .to("400km")                                                
    .includeLower(true)                                         
    .includeUpper(false)                                        
    .optimizeBbox("memory")                                     
    .geoDistance(GeoDistance.ARC);                              

field

center point

starting distance from center point

ending distance from center point

include lower value means that from is gt when false or gte when true

include upper value means that to is lt when false or lte when true

optimize bounding box: memory, indexed or none

distance computation mode: GeoDistance.SLOPPY_ARC (default), GeoDistance.ARC (slightly more precise but significantly slower) or GeoDistance.PLANE (faster, but inaccurate on long distances and close to the poles)

Note that you can cache the result using GeoDistanceRangeFilterBuilder#cache(boolean) method. See Caching.