org.elasticsearch.common.lucene.spatial
Class SpatialStrategy

java.lang.Object
  extended by org.elasticsearch.common.lucene.spatial.SpatialStrategy
Direct Known Subclasses:
TermQueryPrefixTreeStrategy

public abstract class SpatialStrategy
extends Object

Abstraction of the logic used to index and filter Shapes.


Constructor Summary
protected SpatialStrategy(FieldMapper.Names fieldName, SpatialPrefixTree prefixTree, double distanceErrorPct)
          Creates a new SpatialStrategy that will index and Filter using the given field
 
Method Summary
abstract  org.apache.lucene.search.Filter createContainsFilter(com.spatial4j.core.shape.Shape shape)
          Creates a Filter that will find all indexed Shapes that are properly contained within the given Shape (the indexed Shapes will not have any area outside of the given Shape).
abstract  org.apache.lucene.search.Query createContainsQuery(com.spatial4j.core.shape.Shape shape)
          Creates a Query that will find all indexed Shapes that are properly contained within the given Shape (the indexed Shapes will not have any area outside of the given Shape).
abstract  org.apache.lucene.search.Filter createDisjointFilter(com.spatial4j.core.shape.Shape shape)
          Creates a Filter that will find all indexed Shapes that are disjoint to the given Shape
abstract  org.apache.lucene.search.Query createDisjointQuery(com.spatial4j.core.shape.Shape shape)
          Creates a Query that will find all indexed Shapes that are disjoint to the given Shape
 org.apache.lucene.document.Fieldable createField(com.spatial4j.core.shape.Shape shape)
          Converts the given Shape into its indexable format.
 org.apache.lucene.search.Filter createFilter(com.spatial4j.core.shape.Shape shape, ShapeRelation relation)
          Creates a Filter that will find all indexed Shapes that relate to the given Shape
abstract  org.apache.lucene.search.Filter createIntersectsFilter(com.spatial4j.core.shape.Shape shape)
          Creates a Filter that will find all indexed Shapes that intersect with the given Shape
abstract  org.apache.lucene.search.Query createIntersectsQuery(com.spatial4j.core.shape.Shape shape)
          Creates a Query that will find all indexed Shapes that intersect with the given Shape
 org.apache.lucene.search.Query createQuery(com.spatial4j.core.shape.Shape shape, ShapeRelation relation)
          Creates a Query that will find all indexed Shapes that relate to the given Shape
 double getDistanceErrorPct()
          Returns the distance error percentage for this Strategy
 FieldMapper.Names getFieldName()
          Returns the name of the field this Strategy applies to
 SpatialPrefixTree getPrefixTree()
          Returns the SpatialPrefixTree used by this Strategy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpatialStrategy

protected SpatialStrategy(FieldMapper.Names fieldName,
                          SpatialPrefixTree prefixTree,
                          double distanceErrorPct)
Creates a new SpatialStrategy that will index and Filter using the given field

Parameters:
fieldName - Name of the field that the Strategy will index in and Filter
prefixTree - SpatialPrefixTree that will be used to represent Shapes
distanceErrorPct - Distance Error Percentage used to guide the SpatialPrefixTree on how precise it should be
Method Detail

createField

public org.apache.lucene.document.Fieldable createField(com.spatial4j.core.shape.Shape shape)
Converts the given Shape into its indexable format. Implementations should not store the Shape value as well.

Parameters:
shape - Shape to convert ints its indexable format
Returns:
Fieldable for indexing the Shape

createFilter

public org.apache.lucene.search.Filter createFilter(com.spatial4j.core.shape.Shape shape,
                                                    ShapeRelation relation)
Creates a Filter that will find all indexed Shapes that relate to the given Shape

Parameters:
shape - Shape the indexed shapes will relate to
relation - Nature of the relation
Returns:
Filter for finding the related shapes

createQuery

public org.apache.lucene.search.Query createQuery(com.spatial4j.core.shape.Shape shape,
                                                  ShapeRelation relation)
Creates a Query that will find all indexed Shapes that relate to the given Shape

Parameters:
shape - Shape the indexed shapes will relate to
relation - Nature of the relation
Returns:
Query for finding the related shapes

createIntersectsFilter

public abstract org.apache.lucene.search.Filter createIntersectsFilter(com.spatial4j.core.shape.Shape shape)
Creates a Filter that will find all indexed Shapes that intersect with the given Shape

Parameters:
shape - Shape to find the intersection Shapes of
Returns:
Filter finding the intersecting indexed Shapes

createIntersectsQuery

public abstract org.apache.lucene.search.Query createIntersectsQuery(com.spatial4j.core.shape.Shape shape)
Creates a Query that will find all indexed Shapes that intersect with the given Shape

Parameters:
shape - Shape to find the intersection Shapes of
Returns:
Query finding the intersecting indexed Shapes

createDisjointFilter

public abstract org.apache.lucene.search.Filter createDisjointFilter(com.spatial4j.core.shape.Shape shape)
Creates a Filter that will find all indexed Shapes that are disjoint to the given Shape

Parameters:
shape - Shape to find the disjoint Shapes of
Returns:
Filter for finding the disjoint indexed Shapes

createDisjointQuery

public abstract org.apache.lucene.search.Query createDisjointQuery(com.spatial4j.core.shape.Shape shape)
Creates a Query that will find all indexed Shapes that are disjoint to the given Shape

Parameters:
shape - Shape to find the disjoint Shapes of
Returns:
Query for finding the disjoint indexed Shapes

createContainsFilter

public abstract org.apache.lucene.search.Filter createContainsFilter(com.spatial4j.core.shape.Shape shape)
Creates a Filter that will find all indexed Shapes that are properly contained within the given Shape (the indexed Shapes will not have any area outside of the given Shape).

Parameters:
shape - Shape to find the contained Shapes of
Returns:
Filter for finding the contained indexed Shapes

createContainsQuery

public abstract org.apache.lucene.search.Query createContainsQuery(com.spatial4j.core.shape.Shape shape)
Creates a Query that will find all indexed Shapes that are properly contained within the given Shape (the indexed Shapes will not have any area outside of the given Shape).

Parameters:
shape - Shape to find the contained Shapes of
Returns:
Query for finding the contained indexed Shapes

getFieldName

public FieldMapper.Names getFieldName()
Returns the name of the field this Strategy applies to

Returns:
Name of the field the Strategy applies to

getDistanceErrorPct

public double getDistanceErrorPct()
Returns the distance error percentage for this Strategy

Returns:
Distance error percentage for the Strategy

getPrefixTree

public SpatialPrefixTree getPrefixTree()
Returns the SpatialPrefixTree used by this Strategy

Returns:
SpatialPrefixTree used by the Strategy


Copyright © 2009-2012. All Rights Reserved.