org.apache.lucene.spatial.prefix
Class PrefixTreeStrategy
java.lang.Object
org.apache.lucene.spatial.SpatialStrategy
org.apache.lucene.spatial.prefix.PrefixTreeStrategy
- Direct Known Subclasses:
- RecursivePrefixTreeStrategy, TermQueryPrefixTreeStrategy
public abstract class PrefixTreeStrategy
- extends SpatialStrategy
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
grid
protected final SpatialPrefixTree grid
defaultFieldValuesArrayLen
protected int defaultFieldValuesArrayLen
distErrPct
protected double distErrPct
FIELD_TYPE
public static final FieldType FIELD_TYPE
PrefixTreeStrategy
public PrefixTreeStrategy(SpatialPrefixTree grid,
String fieldName)
setDefaultFieldValuesArrayLen
public void setDefaultFieldValuesArrayLen(int defaultFieldValuesArrayLen)
- Used in the in-memory ValueSource as a default ArrayList length for this field's array of values, per doc.
setDistErrPct
public void setDistErrPct(double distErrPct)
- See
SpatialPrefixTree.getMaxLevelForPrecision(com.spatial4j.core.shape.Shape, double)
.
createIndexableFields
public IndexableField[] createIndexableFields(com.spatial4j.core.shape.Shape shape)
- Description copied from class:
SpatialStrategy
- Returns the IndexableField(s) from the
shape
that are to be
added to the Document
. These fields
are expected to be marked as indexed and not stored.
Note: If you want to store the shape as a string for retrieval in
search results, you could add it like this:
document.add(new StoredField(fieldName,ctx.toString(shape)));
The particular string representation used doesn't matter to the Strategy
since it doesn't use it.
- Specified by:
createIndexableFields
in class SpatialStrategy
- Returns:
- Not null nor will it have null elements.
makeValueSource
public ValueSource makeValueSource(SpatialArgs args)
- Description copied from class:
SpatialStrategy
- The value source yields a number that is proportional to the distance between the query shape and indexed data.
- Specified by:
makeValueSource
in class SpatialStrategy
makeValueSource
public ValueSource makeValueSource(SpatialArgs args,
com.spatial4j.core.distance.DistanceCalculator calc)
getGrid
public SpatialPrefixTree getGrid()
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.