|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.spatial.SpatialStrategy
public abstract class SpatialStrategy
The SpatialStrategy encapsulates an approach to indexing and searching based on shapes.
Different implementations will support different features. A strategy should document these common elements:FieldCache
and
DocValues
(ideal) or is it for the entire
index?
Field Summary | |
---|---|
protected com.spatial4j.core.context.SpatialContext |
ctx
|
protected boolean |
ignoreIncompatibleGeometry
|
Constructor Summary | |
---|---|
SpatialStrategy(com.spatial4j.core.context.SpatialContext ctx,
String fieldName)
Constructs the spatial strategy with its mandatory arguments. |
Method Summary | |
---|---|
abstract IndexableField[] |
createIndexableFields(com.spatial4j.core.shape.Shape shape)
Returns the IndexableField(s) from the shape that are to be
added to the Document . |
String |
getFieldName()
The name of the field or the prefix of them if there are multiple fields needed internally. |
com.spatial4j.core.context.SpatialContext |
getSpatialContext()
|
boolean |
isIgnoreIncompatibleGeometry()
|
abstract 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. |
abstract ValueSource |
makeValueSource(SpatialArgs args)
The value source yields a number that is proportional to the distance between the query shape and indexed data. |
void |
setIgnoreIncompatibleGeometry(boolean ignoreIncompatibleGeometry)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean ignoreIncompatibleGeometry
protected final com.spatial4j.core.context.SpatialContext ctx
Constructor Detail |
---|
public SpatialStrategy(com.spatial4j.core.context.SpatialContext ctx, String fieldName)
Method Detail |
---|
public com.spatial4j.core.context.SpatialContext getSpatialContext()
public String getFieldName()
public abstract IndexableField[] createIndexableFields(com.spatial4j.core.shape.Shape shape)
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.
public abstract ValueSource makeValueSource(SpatialArgs args)
public Query makeQuery(SpatialArgs args)
FilteredQuery
based on
makeFilter(org.apache.lucene.spatial.query.SpatialArgs)
and
makeValueSource(org.apache.lucene.spatial.query.SpatialArgs)
.
public abstract Filter makeFilter(SpatialArgs args)
public boolean isIgnoreIncompatibleGeometry()
public void setIgnoreIncompatibleGeometry(boolean ignoreIncompatibleGeometry)
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |