public static class AggregationGeoNear.Builder extends Object
Find
queries.Modifier and Type | Field and Description |
---|---|
protected String |
myDistanceField
The name of the field to place the distance from the source
location . |
protected Double |
myDistanceMultiplier
The distance multiplier to use in the
$geoNear , if set. |
protected Long |
myLimit
The maximum number of documents to return, if set.
|
protected Point2D |
myLocation
The location to find documents near.
|
protected String |
myLocationField
The name of the field to place the location information from the
document, if set.
|
protected Double |
myMaxDistance
The maximum distance to return documents from the specified location,
if set.
|
protected Document |
myQuery
The optional query for further refining the documents to add to the
pipeline.
|
protected boolean |
mySpherical
If true the
$geoNear should compute distances using spherical
coordinates instead of planar coordinates. |
protected boolean |
myUniqueDocs
If true the
$geoNear should only return documents once. |
Constructor and Description |
---|
AggregationGeoNear.Builder()
Creates a new Builder.
|
Modifier and Type | Method and Description |
---|---|
AggregationGeoNear |
build()
Constructs a new
AggregationGeoNear object from the state of
the builder. |
AggregationGeoNear.Builder |
distanceField(String distanceField)
Sets the name of the field to place the distance from the source
location . |
AggregationGeoNear.Builder |
distanceMultiplier(double distanceMultiplier)
Sets the distance multiplier to use in the
$geoNear . |
AggregationGeoNear.Builder |
limit(long limit)
Sets the maximum number of documents to return.
|
AggregationGeoNear.Builder |
location(Point2D location)
Sets the location to find documents near.
|
AggregationGeoNear.Builder |
locationField(String locationField)
Sets the name of the field to place the location information from the
document.
|
AggregationGeoNear.Builder |
maxDistance(double maxDistance)
Sets the maximum distance to return documents from the specified
location.
|
AggregationGeoNear.Builder |
query(DocumentAssignable query)
Sets the optional query for further refining the documents to add to
the pipeline.
|
AggregationGeoNear.Builder |
reset()
Resets the builder back to its initial state for reuse.
|
AggregationGeoNear.Builder |
setDistanceField(String distanceField)
Sets the name of the field to place the distance from the source
location . |
AggregationGeoNear.Builder |
setDistanceMultiplier(double distanceMultiplier)
Sets the distance multiplier to use in the
$geoNear . |
AggregationGeoNear.Builder |
setLimit(long limit)
Sets the maximum number of documents to return.
|
AggregationGeoNear.Builder |
setLocation(Point2D location)
Sets the location to find documents near.
|
AggregationGeoNear.Builder |
setLocationField(String locationField)
Sets the name of the field to place the location information from the
document.
|
AggregationGeoNear.Builder |
setMaxDistance(double maxDistance)
Sets the maximum distance to return documents from the specified
location.
|
AggregationGeoNear.Builder |
setQuery(DocumentAssignable query)
Sets the optional query for further refining the documents to add to
the pipeline.
|
AggregationGeoNear.Builder |
setSpherical(boolean spherical)
Sets if (true) the
$geoNear should compute distances using
spherical coordinates instead of planar coordinates. |
AggregationGeoNear.Builder |
setUniqueDocs(boolean uniqueDocs)
Sets if (true) the
$geoNear should only return documents
once. |
AggregationGeoNear.Builder |
spherical()
Sets the
$geoNear to compute distances using spherical
coordinates instead of planar coordinates. |
AggregationGeoNear.Builder |
spherical(boolean spherical)
Sets if (true) the
$geoNear should compute distances using
spherical coordinates instead of planar coordinates. |
AggregationGeoNear.Builder |
uniqueDocs(boolean uniqueDocs)
Sets if (true) the
$geoNear should only return documents
once. |
protected String myDistanceField
location
.protected Double myDistanceMultiplier
$geoNear
, if set.
null
otherwise.protected Long myLimit
null
otherwise.protected Point2D myLocation
protected String myLocationField
null
otherwise.protected Double myMaxDistance
null
otherwise.protected Document myQuery
protected boolean mySpherical
$geoNear
should compute distances using spherical
coordinates instead of planar coordinates. Defaults to false.protected boolean myUniqueDocs
$geoNear
should only return documents once.
Defaults to true.public AggregationGeoNear.Builder()
public AggregationGeoNear build()
AggregationGeoNear
object from the state of
the builder.AggregationGeoNear
object.IllegalArgumentException
- If the location
or
distance field
have not
been set.public AggregationGeoNear.Builder distanceField(String distanceField)
location
.
This method delegates to setDistanceField(String)
.
distanceField
- The new name of the field to place the distance from the
source location
.public AggregationGeoNear.Builder distanceMultiplier(double distanceMultiplier)
$geoNear
.
This method delegates to setDistanceMultiplier(double)
.
distanceMultiplier
- The new distance multiplier to use in the $geoNear
.public AggregationGeoNear.Builder limit(long limit)
This method delegates to setLimit(long)
.
limit
- The new maximum number of documents to return.public AggregationGeoNear.Builder location(Point2D location)
This method delegates to setLocation(Point2D)
.
location
- The new location to find documents near.GeoJson.p(double, double)
public AggregationGeoNear.Builder locationField(String locationField)
This method delegates to setLocationField(String)
.
locationField
- The new name of the field to place the location
information from the document.public AggregationGeoNear.Builder maxDistance(double maxDistance)
This method delegates to setMaxDistance(double)
.
maxDistance
- The new maximum distance to return documents from the
specified location.public AggregationGeoNear.Builder query(DocumentAssignable query)
This method delegates to setQuery(DocumentAssignable)
.
query
- The new optional query for further refining the documents
to add to the pipeline.public AggregationGeoNear.Builder reset()
public AggregationGeoNear.Builder setDistanceField(String distanceField)
location
.distanceField
- The new name of the field to place the distance from the
source location
.public AggregationGeoNear.Builder setDistanceMultiplier(double distanceMultiplier)
$geoNear
.distanceMultiplier
- The new distance multiplier to use in the $geoNear
.public AggregationGeoNear.Builder setLimit(long limit)
limit
- The new maximum number of documents to return.public AggregationGeoNear.Builder setLocation(Point2D location)
location
- The new location to find documents near.GeoJson.p(double, double)
public AggregationGeoNear.Builder setLocationField(String locationField)
locationField
- The new name of the field to place the location
information from the document.public AggregationGeoNear.Builder setMaxDistance(double maxDistance)
maxDistance
- The new maximum distance to return documents from the
specified location.public AggregationGeoNear.Builder setQuery(DocumentAssignable query)
query
- The new optional query for further refining the documents
to add to the pipeline.public AggregationGeoNear.Builder setSpherical(boolean spherical)
$geoNear
should compute distances using
spherical coordinates instead of planar coordinates. Defaults to
false.spherical
- The new value for if the $geoNear
should compute
distances using spherical coordinates instead of planar
coordinatespublic AggregationGeoNear.Builder setUniqueDocs(boolean uniqueDocs)
$geoNear
should only return documents
once. Defaults to true.uniqueDocs
- The new value for if the $geoNear
should only
return documents once.public AggregationGeoNear.Builder spherical()
$geoNear
to compute distances using spherical
coordinates instead of planar coordinates.
This method delegates to setSpherical(true)
.
public AggregationGeoNear.Builder spherical(boolean spherical)
$geoNear
should compute distances using
spherical coordinates instead of planar coordinates. Defaults to
false.
This method delegates to setSpherical(boolean)
.
spherical
- The new value for if the $geoNear
should compute
distances using spherical coordinates instead of planar
coordinatespublic AggregationGeoNear.Builder uniqueDocs(boolean uniqueDocs)
$geoNear
should only return documents
once. Defaults to true.
This method delegates to setUniqueDocs(boolean)
.
uniqueDocs
- The new value for if the $geoNear
should only
return documents once.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.