public class NearQuery extends Object
Modifier and Type | Method and Description |
---|---|
NearQuery |
distanceMultiplier(double distanceMultiplier)
Configures a distance multiplier the resulting distances get applied.
|
NearQuery |
distanceMultiplier(Metric metric)
Configures the distance multiplier to the multiplier of the given
Metric . |
Metric |
getMetric()
Returns the
Metric underlying the actual query. |
NearQuery |
inKilometers()
Will cause the results' distances being returned in kilometers.
|
NearQuery |
inMiles()
Will cause the results' distances being returned in miles.
|
NearQuery |
maxDistance(Distance distance)
Sets the maximum distance to the given
Distance . |
NearQuery |
maxDistance(double maxDistance)
Sets the max distance results shall have from the configured origin.
|
NearQuery |
maxDistance(double maxDistance,
Metric metric)
Sets the maximum distance supplied in a given metric.
|
static NearQuery |
near(double x,
double y)
Creates a new
NearQuery starting near the given coordinates. |
static NearQuery |
near(double x,
double y,
Metric metric)
|
static NearQuery |
near(Point point)
|
static NearQuery |
near(Point point,
Metric metric)
|
NearQuery |
num(int num)
Configures the number of results to return.
|
NearQuery |
query(Query query)
Adds an actual query to the
NearQuery to restrict the objects considered for the actual near operation. |
NearQuery |
spherical(boolean spherical)
Configures whether to return spherical values for the actual distance.
|
DBObject |
toDBObject()
|
public static NearQuery near(double x, double y)
NearQuery
starting near the given coordinates.i
- j
- public static NearQuery near(double x, double y, Metric metric)
NearQuery
starting at the given coordinates using the given Metric
to adapt given
values to further configuration. E.g. setting a maxDistance(double)
will be interpreted as a value of the
initially set Metric
.x
- y
- metric
- public static NearQuery near(Point point, Metric metric)
NearQuery
starting near the given Point
using the given Metric
to adapt given
values to further configuration. E.g. setting a maxDistance(double)
will be interpreted as a value of the
initially set Metric
.point
- must not be null.metric
- public NearQuery num(int num)
num
- public NearQuery maxDistance(double maxDistance)
Metric
.maxDistance
- public NearQuery maxDistance(double maxDistance, Metric metric)
Metric
.maxDistance
- metric
- must not be null.public NearQuery maxDistance(Distance distance)
Distance
.distance
- public NearQuery distanceMultiplier(double distanceMultiplier)
distanceMultiplier
- public NearQuery distanceMultiplier(Metric metric)
Metric
. Does not recalculate the
maxDistance(double)
.metric
- must not be null.public NearQuery spherical(boolean spherical)
spherical
- public NearQuery inKilometers()
distanceMultiplier(double)
and
spherical(boolean)
accordingly.public NearQuery inMiles()
distanceMultiplier(double)
and
spherical(boolean)
accordingly.public NearQuery query(Query query)
NearQuery
to restrict the objects considered for the actual near operation.query
- public DBObject toDBObject()
Copyright © 2012. All Rights Reserved.