org.elasticsearch.search.sort
Class GeoDistanceSortBuilder

java.lang.Object
  extended by org.elasticsearch.search.sort.SortBuilder
      extended by org.elasticsearch.search.sort.GeoDistanceSortBuilder
All Implemented Interfaces:
ToXContent

public class GeoDistanceSortBuilder
extends SortBuilder

A geo distance based sorting on a geo point like field.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
GeoDistanceSortBuilder(String fieldName)
          Constructs a new distance based sort on a geo point like field.
 
Method Summary
 GeoDistanceSortBuilder geoDistance(GeoDistance geoDistance)
          The geo distance type used to compute the distance.
 GeoDistanceSortBuilder geohash(String geohash)
          The geohash of the geo point to create the range distance facets from.
 SortBuilder missing(Object missing)
          Not relevant.
 GeoDistanceSortBuilder order(SortOrder order)
          The order of sorting.
 GeoDistanceSortBuilder point(double lat, double lon)
          The point to create the range distance facets from.
 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params)
           
 GeoDistanceSortBuilder unit(DistanceUnit unit)
          The distance unit to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeoDistanceSortBuilder

public GeoDistanceSortBuilder(String fieldName)
Constructs a new distance based sort on a geo point like field.

Parameters:
fieldName - The geo point like field name.
Method Detail

point

public GeoDistanceSortBuilder point(double lat,
                                    double lon)
The point to create the range distance facets from.

Parameters:
lat - latitude.
lon - longitude.

geohash

public GeoDistanceSortBuilder geohash(String geohash)
The geohash of the geo point to create the range distance facets from.


geoDistance

public GeoDistanceSortBuilder geoDistance(GeoDistance geoDistance)
The geo distance type used to compute the distance.


unit

public GeoDistanceSortBuilder unit(DistanceUnit unit)
The distance unit to use. Defaults to DistanceUnit.KILOMETERS


order

public GeoDistanceSortBuilder order(SortOrder order)
The order of sorting. Defaults to SortOrder.ASC.

Specified by:
order in class SortBuilder

missing

public SortBuilder missing(Object missing)
Not relevant.

Specified by:
missing in class SortBuilder

toXContent

public XContentBuilder toXContent(XContentBuilder builder,
                                  ToXContent.Params params)
                           throws IOException
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.