ejsGeoDistanceRangeFilter

A filter that restricts matched results/docs to a given distance range from the point of origin. The format conforms with the GeoJSON specification.

Module

 GeoDistanceRangeFilter

GeoDistanceRangeFilter ( fieldName )
Filter results to those which fall within the given distance range of the point of origin.

Parameters
fieldName <String> the document property/field containing the Geo Point (lon/lat).

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectcache(trueFalse)Enable or disable caching of the filter
ObjectcacheKey(key)Sets the cache key.
ObjectdistanceType(type)How to compute the distance. Can either be arc (better precision) or plane (faster). Defaults to arc.
Objectfield(f)Sets the fields to filter against.
Objectfrom(numericDistance)Sets the start point of the distance range
Objectgt(val)Greater than value. Same as setting from to the value, and include_lower to false,
Objectgte(val)Greater than or equal to value. Same as setting from to the value, and include_lower to true.
ObjectincludeLower(trueFalse)Should the first from (if set) be inclusive or not. Defaults to true
ObjectincludeUpper(trueFalse)Should the last to (if set) be inclusive or not. Defaults to true.
Objectlt(val)Less than value. Same as setting to to the value, and include_upper to false.
Objectlte(val)Less than or equal to value. Same as setting to to the value, and include_upper to true.
Objectname(name)Sets the filter name.
Objectnormalize(trueFalse)If the lat/long points should be normalized to lie within their respective normalized ranges. Normalized ranges are: lon = -180 (exclusive) to 180 (inclusive) range lat = -90 to 90 (both inclusive) range
ObjectoptimizeBbox(t)Will an optimization of using first a bounding box check will be used. Defaults to memory which will do in memory checks. Can also have values of indexed to use indexed value check, or none which disables bounding box optimization.
Objectpoint(p)Sets the point of origin in which distance will be measured from
Objectto(numericDistance)Sets the end point of the distance range
ObjecttoJSON()Returns the filter object.
Objectunit(unit)Sets the distance unit. Valid values are "mi" for miles or "km" for kilometers. Defaults to "km".

Method Detail

 _type

String _type ( )
The type of ejs object. For internal use only.

Returns
the type of object

 cache

Object cache ( trueFalse )
Enable or disable caching of the filter

Parameters
trueFalse <Boolean> True to cache the filter, false otherwise.
Returns
returns this so that calls can be chained.

 cacheKey

Object cacheKey ( key )
Sets the cache key.

Parameters
key <String> the cache key as a string.
Returns
returns this so that calls can be chained.

 distanceType

Object distanceType ( type )
How to compute the distance. Can either be arc (better precision) or plane (faster). Defaults to arc.

Parameters
type <String> The execution type as a string.
Returns
returns this so that calls can be chained.

 field

Object field ( f )
Sets the fields to filter against.

Parameters
f <String> A valid field name.
Returns
returns this so that calls can be chained.

 from

Object from ( numericDistance )
Sets the start point of the distance range

Parameters
numericDistance <Number> the numeric distance
Returns
returns this so that calls can be chained.

 gt

Object gt ( val )
Greater than value. Same as setting from to the value, and include_lower to false,

Parameters
val <Number> the numeric distance
Returns
returns this so that calls can be chained.

 gte

Object gte ( val )
Greater than or equal to value. Same as setting from to the value, and include_lower to true.

Parameters
val <Number> the numeric distance
Returns
returns this so that calls can be chained.

 includeLower

Object includeLower ( trueFalse )
Should the first from (if set) be inclusive or not. Defaults to true

Parameters
trueFalse <Boolean> true to include, false to exclude
Returns
returns this so that calls can be chained.

 includeUpper

Object includeUpper ( trueFalse )
Should the last to (if set) be inclusive or not. Defaults to true.

Parameters
trueFalse <Boolean> true to include, false to exclude
Returns
returns this so that calls can be chained.

 lt

Object lt ( val )
Less than value. Same as setting to to the value, and include_upper to false.

Parameters
val <Number> the numeric distance
Returns
returns this so that calls can be chained.

 lte

Object lte ( val )
Less than or equal to value. Same as setting to to the value, and include_upper to true.

Parameters
val <Number> the numeric distance
Returns
returns this so that calls can be chained.

 name

Object name ( name )
Sets the filter name.

Parameters
name <String> A name for the filter.
Returns
returns this so that calls can be chained.

 normalize

Object normalize ( trueFalse )
If the lat/long points should be normalized to lie within their respective normalized ranges. Normalized ranges are: lon = -180 (exclusive) to 180 (inclusive) range lat = -90 to 90 (both inclusive) range

Parameters
trueFalse <String> True if the coordinates should be normalized. False otherwise.
Returns
returns this so that calls can be chained.

 optimizeBbox

Object optimizeBbox ( t )
Will an optimization of using first a bounding box check will be used. Defaults to memory which will do in memory checks. Can also have values of indexed to use indexed value check, or none which disables bounding box optimization.

Parameters
t <String> optimization type of memory, indexed, or none.
Returns
returns this so that calls can be chained.

 point

Object point ( p )
Sets the point of origin in which distance will be measured from

Parameters
p <GeoPoint> A valid GeoPoint object.
Returns
returns this so that calls can be chained.

 to

Object to ( numericDistance )
Sets the end point of the distance range

Parameters
numericDistance <Number> the numeric distance
Returns
returns this so that calls can be chained.

 toJSON

Object toJSON ( )
Returns the filter object.

Returns
filter object

 unit

Object unit ( unit )
Sets the distance unit. Valid values are "mi" for miles or "km" for kilometers. Defaults to "km".

Parameters
unit <Number> the unit of distance measure.
Returns
returns this so that calls can be chained.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo