Package org.apache.solr.legacy
Class PointVectorStrategy
- java.lang.Object
-
- org.apache.lucene.spatial.SpatialStrategy
-
- org.apache.solr.legacy.PointVectorStrategy
-
public class PointVectorStrategy extends org.apache.lucene.spatial.SpatialStrategySimpleSpatialStrategywhich represents Points in two numeric fields. The Strategy's best feature is decent distance sort.Characteristics:
- Only indexes points; just one per field value.
- Can query by a rectangle or circle.
SpatialOperation.IntersectsandSpatialOperation.IsWithinis supported.- Requires DocValues for
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 onSpatialStrategy.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.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.lucene.document.FieldTypeDEFAULT_FIELDTYPEpointValues, docValues, and nothing else.static LegacyFieldTypeLEGACY_FIELDTYPEDeprecated.static StringSUFFIX_Xstatic StringSUFFIX_Y
-
Constructor Summary
Constructors Constructor Description PointVectorStrategy(org.locationtech.spatial4j.context.SpatialContext ctx, String fieldNamePrefix, org.apache.lucene.document.FieldType fieldType)Create a new instance configured with the provided FieldType options.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.apache.lucene.document.Field[]createIndexableFields(org.locationtech.spatial4j.shape.Point point)org.apache.lucene.document.Field[]createIndexableFields(org.locationtech.spatial4j.shape.Shape shape)org.apache.lucene.search.DoubleValuesSourcemakeDistanceValueSource(org.locationtech.spatial4j.shape.Point queryPoint, double multiplier)org.apache.lucene.search.ConstantScoreQuerymakeQuery(org.apache.lucene.spatial.query.SpatialArgs args)static PointVectorStrategynewInstance(org.locationtech.spatial4j.context.SpatialContext ctx, String fieldNamePrefix)Create a newPointVectorStrategyinstance that usesDoublePointandDoublePoint.newRangeQuery(java.lang.String, double, double)static PointVectorStrategynewLegacyInstance(org.locationtech.spatial4j.context.SpatialContext ctx, String fieldNamePrefix)Deprecated.LegacyNumerics will be removed
-
-
-
Field Detail
-
DEFAULT_FIELDTYPE
public static org.apache.lucene.document.FieldType DEFAULT_FIELDTYPE
pointValues, docValues, and nothing else.
-
LEGACY_FIELDTYPE
@Deprecated public static LegacyFieldType LEGACY_FIELDTYPE
Deprecated.
-
SUFFIX_X
public static final String SUFFIX_X
- See Also:
- Constant Field Values
-
SUFFIX_Y
public static final String SUFFIX_Y
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PointVectorStrategy
public PointVectorStrategy(org.locationtech.spatial4j.context.SpatialContext ctx, String fieldNamePrefix, org.apache.lucene.document.FieldType fieldType)Create a new instance configured with the provided FieldType options. SeeDEFAULT_FIELDTYPE. a field type is used to articulate the desired options (namely pointValues, docValues, stored). Legacy numerics is configurable this way too.
-
-
Method Detail
-
newInstance
public static PointVectorStrategy newInstance(org.locationtech.spatial4j.context.SpatialContext ctx, String fieldNamePrefix)
Create a newPointVectorStrategyinstance that usesDoublePointandDoublePoint.newRangeQuery(java.lang.String, double, double)
-
newLegacyInstance
@Deprecated public static PointVectorStrategy newLegacyInstance(org.locationtech.spatial4j.context.SpatialContext ctx, String fieldNamePrefix)
Deprecated.LegacyNumerics will be removedCreate a newPointVectorStrategyinstance that usesLegacyDoubleFieldfor backwards compatibility. However, back-compat is limited; we don't support circle queries ormakeDistanceValueSource(Point, double)since that requires docValues (the legacy config didn't have that).
-
createIndexableFields
public org.apache.lucene.document.Field[] createIndexableFields(org.locationtech.spatial4j.shape.Shape shape)
- Specified by:
createIndexableFieldsin classorg.apache.lucene.spatial.SpatialStrategy
-
createIndexableFields
public org.apache.lucene.document.Field[] createIndexableFields(org.locationtech.spatial4j.shape.Point point)
-
makeDistanceValueSource
public org.apache.lucene.search.DoubleValuesSource makeDistanceValueSource(org.locationtech.spatial4j.shape.Point queryPoint, double multiplier)- Specified by:
makeDistanceValueSourcein classorg.apache.lucene.spatial.SpatialStrategy
-
makeQuery
public org.apache.lucene.search.ConstantScoreQuery makeQuery(org.apache.lucene.spatial.query.SpatialArgs args)
- Specified by:
makeQueryin classorg.apache.lucene.spatial.SpatialStrategy
-
-