org.apache.lucene.spatial.vector
Class TwoDoublesStrategy

java.lang.Object
  extended by org.apache.lucene.spatial.SpatialStrategy
      extended by org.apache.lucene.spatial.vector.TwoDoublesStrategy

public class TwoDoublesStrategy
extends SpatialStrategy

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
 int precisionStep
           
static String SUFFIX_X
           
static String SUFFIX_Y
           
 
Fields inherited from class org.apache.lucene.spatial.SpatialStrategy
ctx, ignoreIncompatibleGeometry
 
Constructor Summary
TwoDoublesStrategy(com.spatial4j.core.context.SpatialContext ctx, String fieldNamePrefix)
           
 
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.
 Filter makeFilter(SpatialArgs args)
          Make a Filter
 Query makeQuery(SpatialArgs args)
          Make a query which has a score based on the distance from the data to the query shape.
 ValueSource makeValueSource(SpatialArgs args)
          The value source yields a number that is proportional to the distance between the query shape and indexed data.
 void setPrecisionStep(int p)
           
 
Methods inherited from class org.apache.lucene.spatial.SpatialStrategy
getFieldName, getSpatialContext, isIgnoreIncompatibleGeometry, setIgnoreIncompatibleGeometry, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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

precisionStep

public int precisionStep
Constructor Detail

TwoDoublesStrategy

public TwoDoublesStrategy(com.spatial4j.core.context.SpatialContext ctx,
                          String fieldNamePrefix)
Method Detail

setPrecisionStep

public void setPrecisionStep(int p)

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

makeFilter

public Filter makeFilter(SpatialArgs args)
Description copied from class: SpatialStrategy
Make a Filter

Specified by:
makeFilter in class SpatialStrategy

makeQuery

public Query makeQuery(SpatialArgs args)
Description copied from class: SpatialStrategy
Make a query which has a score based on the distance from the data to the query shape. The default implementation constructs a FilteredQuery based on SpatialStrategy.makeFilter(org.apache.lucene.spatial.query.SpatialArgs) and SpatialStrategy.makeValueSource(org.apache.lucene.spatial.query.SpatialArgs).

Overrides:
makeQuery in class SpatialStrategy


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.