public class PointVectorStrategy extends SpatialStrategy
SpatialStrategy which represents Points in two numeric fields.
The Strategy's best feature is decent distance sort.
Characteristics:
SpatialOperation.Intersects and SpatialOperation.IsWithin is supported.SpatialStrategy.makeDistanceValueSource(org.locationtech.spatial4j.shape.Point) and for
searching with a Circle.Implementation:
This is a simple Strategy. Search works with a pair of range queries on two DoublePoints representing
x & y fields. A Circle query does the same bbox query but adds a
ValueSource filter on
SpatialStrategy.makeDistanceValueSource(org.locationtech.spatial4j.shape.Point).
One performance shortcoming with this strategy is that a scenario involving both a search using a Circle and sort will result in calculations for the spatial distance being done twice -- once for the filter and second for the sort.
| Modifier and Type | Field and Description |
|---|---|
static FieldType |
DEFAULT_FIELDTYPE
pointValues, docValues, and nothing else.
|
static LegacyFieldType |
LEGACY_FIELDTYPE
Deprecated.
|
static String |
SUFFIX_X |
static String |
SUFFIX_Y |
ctx| Constructor and Description |
|---|
PointVectorStrategy(org.locationtech.spatial4j.context.SpatialContext ctx,
String fieldNamePrefix,
FieldType fieldType)
Create a new instance configured with the provided FieldType options.
|
| Modifier and Type | Method and Description |
|---|---|
Field[] |
createIndexableFields(org.locationtech.spatial4j.shape.Point point) |
Field[] |
createIndexableFields(org.locationtech.spatial4j.shape.Shape shape) |
DoubleValuesSource |
makeDistanceValueSource(org.locationtech.spatial4j.shape.Point queryPoint,
double multiplier) |
ConstantScoreQuery |
makeQuery(SpatialArgs args) |
static PointVectorStrategy |
newInstance(org.locationtech.spatial4j.context.SpatialContext ctx,
String fieldNamePrefix)
Create a new
PointVectorStrategy instance that uses DoublePoint and DoublePoint.newRangeQuery(java.lang.String, double, double) |
static PointVectorStrategy |
newLegacyInstance(org.locationtech.spatial4j.context.SpatialContext ctx,
String fieldNamePrefix)
Deprecated.
LegacyNumerics will be removed
|
getFieldName, getSpatialContext, makeDistanceValueSource, makeRecipDistanceValueSource, toStringpublic static FieldType DEFAULT_FIELDTYPE
@Deprecated public static LegacyFieldType LEGACY_FIELDTYPE
public static final String SUFFIX_X
public static final String SUFFIX_Y
public PointVectorStrategy(org.locationtech.spatial4j.context.SpatialContext ctx,
String fieldNamePrefix,
FieldType fieldType)
DEFAULT_FIELDTYPE.
a field type is used to articulate the desired options (namely pointValues, docValues, stored). Legacy numerics
is configurable this way too.public static PointVectorStrategy newInstance(org.locationtech.spatial4j.context.SpatialContext ctx, String fieldNamePrefix)
PointVectorStrategy instance that uses DoublePoint and DoublePoint.newRangeQuery(java.lang.String, double, double)@Deprecated public static PointVectorStrategy newLegacyInstance(org.locationtech.spatial4j.context.SpatialContext ctx, String fieldNamePrefix)
PointVectorStrategy instance that uses LegacyDoubleField for backwards compatibility.
However, back-compat is limited; we don't support circle queries or makeDistanceValueSource(Point, double)
since that requires docValues (the legacy config didn't have that).public Field[] createIndexableFields(org.locationtech.spatial4j.shape.Shape shape)
createIndexableFields in class SpatialStrategypublic Field[] createIndexableFields(org.locationtech.spatial4j.shape.Point point)
public DoubleValuesSource makeDistanceValueSource(org.locationtech.spatial4j.shape.Point queryPoint, double multiplier)
makeDistanceValueSource in class SpatialStrategypublic ConstantScoreQuery makeQuery(SpatialArgs args)
makeQuery in class SpatialStrategyCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.