org.apache.blur.analysis.type.spatial
Class SpatialArgsParser
java.lang.Object
org.apache.blur.analysis.type.spatial.SpatialArgsParser
public class SpatialArgsParser
- extends Object
Parses a string that usually looks like "OPERATION(SHAPE)" into a
SpatialArgs
object. The set of operations supported are defined in
SpatialOperation
, such as "Intersects" being a common one. The shape
portion is defined by ShapeReadWriter.readShape(String)
. There are
some optional name-value pair parameters that follow the closing parenthesis.
Example:
Intersects(-10,20,-8,22) distErrPct=0.025
In the future it would be good to support something at least
semi-standardized like a variant of [E]CQL.
Method Summary |
static org.apache.lucene.spatial.query.SpatialArgs |
parse(String v,
ShapeReadWriter<com.spatial4j.core.context.SpatialContext> shapeReadWriter)
Parses a string such as "Intersects(-10,20,-8,22) distErrPct=0.025". |
static String |
writeSpatialArgs(org.apache.lucene.spatial.query.SpatialArgs args,
ShapeReadWriter<com.spatial4j.core.context.SpatialContext> shapeReadWriter)
Writes a close approximation to the parsed input format. |
DIST_ERR_PCT
public static final String DIST_ERR_PCT
- See Also:
- Constant Field Values
DIST_ERR
public static final String DIST_ERR
- See Also:
- Constant Field Values
SpatialArgsParser
public SpatialArgsParser()
writeSpatialArgs
public static String writeSpatialArgs(org.apache.lucene.spatial.query.SpatialArgs args,
ShapeReadWriter<com.spatial4j.core.context.SpatialContext> shapeReadWriter)
- Writes a close approximation to the parsed input format.
parse
public static org.apache.lucene.spatial.query.SpatialArgs parse(String v,
ShapeReadWriter<com.spatial4j.core.context.SpatialContext> shapeReadWriter)
throws IllegalArgumentException,
com.spatial4j.core.exception.InvalidShapeException
- Parses a string such as "Intersects(-10,20,-8,22) distErrPct=0.025".
- Parameters:
v
- The string to parse. Mandatory.shapeReadWriter
- The spatial shapeReadWriter. Mandatory.
- Returns:
- Not null.
- Throws:
IllegalArgumentException
- If there is a problem parsing the string.
com.spatial4j.core.exception.InvalidShapeException
- Thrown from ShapeReadWriter.readShape(String)
Copyright © 2012-2014 The Apache Software Foundation. All Rights Reserved.