org.apache.lucene.spatial.prefix
Class PrefixTreeStrategy

java.lang.Object
  extended by org.apache.lucene.spatial.SpatialStrategy
      extended by 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.

Field Summary
protected  int defaultFieldValuesArrayLen
           
protected  double distErrPct
           
static FieldType FIELD_TYPE
           
protected  SpatialPrefixTree grid
           
 
Fields inherited from class org.apache.lucene.spatial.SpatialStrategy
ctx, ignoreIncompatibleGeometry
 
Constructor Summary
PrefixTreeStrategy(SpatialPrefixTree grid, String fieldName)
           
 
Method Summary
 IndexableField[] createIndexableFields(com.spatial4j.core.shape.Shape shape)
          Returns the IndexableField(s) from the shape that are to be added to the Document.
 SpatialPrefixTree getGrid()
           
 ValueSource makeValueSource(SpatialArgs args)
          The value source yields a number that is proportional to the distance between the query shape and indexed data.
 ValueSource makeValueSource(SpatialArgs args, com.spatial4j.core.distance.DistanceCalculator calc)
           
 void setDefaultFieldValuesArrayLen(int defaultFieldValuesArrayLen)
          Used in the in-memory ValueSource as a default ArrayList length for this field's array of values, per doc.
 void setDistErrPct(double distErrPct)
          See SpatialPrefixTree.getMaxLevelForPrecision(com.spatial4j.core.shape.Shape, double).
 
Methods inherited from class org.apache.lucene.spatial.SpatialStrategy
getFieldName, getSpatialContext, isIgnoreIncompatibleGeometry, makeFilter, makeQuery, setIgnoreIncompatibleGeometry, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

grid

protected final SpatialPrefixTree grid

defaultFieldValuesArrayLen

protected int defaultFieldValuesArrayLen

distErrPct

protected double distErrPct

FIELD_TYPE

public static final FieldType FIELD_TYPE
Constructor Detail

PrefixTreeStrategy

public PrefixTreeStrategy(SpatialPrefixTree grid,
                          String fieldName)
Method Detail

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.