Package org.apache.lucene.document
Class ShapeDocValues
java.lang.Object
org.apache.lucene.document.ShapeDocValues
- Direct Known Subclasses:
LatLonShapeDocValues
,XYShapeDocValues
A binary doc values format representation for
LatLonShape
and XYShape
Note that this class cannot be instantiated directly due to different encodings XYEncodingUtils
and GeoEncodingUtils
Concrete Implementations include: LatLonShapeDocValues
and XYShapeDocValues
ShapeDocValues also does not support Multi Geometries because the area of the original
geometries must be included to compute an accurate centroid. To support multi geometries binary
doc values will need to be updated to support multi values (see: NumericDocValues
and SortedNumericDocValues
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface
private static final class
Reads values from a ShapeDocValues Fieldprivate final class
Shape Comparator class provides tree traversal relation methodsprivate final class
Builds an in memory binary tree of tessellated triangles.private final class
Writes data from a ShapeDocValues field to a data output array -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Geometry
the bounding box of the shape docvalueprotected final Geometry
the centroid of the shape docvalueprivate final BytesRef
the binary doc valueprotected final ShapeDocValues.ShapeComparator
the geometry comparator used to check relationsprotected static final byte
doc value format version; used to support bwc for any encoding changes -
Constructor Summary
ConstructorsConstructorDescriptionShapeDocValues
(List<ShapeField.DecodedTriangle> tessellation) Creates a instance from a shape tessellationShapeDocValues
(BytesRef binaryValue) Creates aShapeDocValues
instance from a given serialized value -
Method Summary
Modifier and TypeMethodDescriptionprotected BytesRef
returns the encoded doc values field as aBytesRef
private ShapeDocValues.TreeNode
buildTree
(List<ShapeField.DecodedTriangle> tessellation, List<ShapeDocValues.TreeNode> dfsSerialized) main entry point to build the tessellation tree *private BytesRef
computeBinaryValue
(List<ShapeField.DecodedTriangle> tessellation) protected abstract Geometry
protected abstract Geometry
private int
computeComponentSize
(ShapeDocValues.TreeNode node, int maxX, int maxY) private ShapeDocValues.TreeNode
createTree
(ShapeDocValues.TreeNode[] triangles, int low, int high, boolean splitX, ShapeDocValues.TreeNode parent, List<ShapeDocValues.TreeNode> dfsSerialized) creates the treeabstract Geometry
abstract Geometry
protected int
Retrieves the encoded x centroid location for the geometry(s)protected int
Retrieves the encoded y centroid location for the geometry(s)int
returns the max x value for the shape's bounding boxint
returns the max y value for the shape's bounding boxint
returns the min x value for the shape's bounding boxint
returns the min y value for the shape's bounding boxprotected abstract ShapeDocValues.Encoder
Retrieves the highest dimensional type (POINT, LINE, TRIANGLE) for computing the geometry(s) centroidstatic Query
newGeometryQuery
(String field, ShapeField.QueryRelation relation, Object... geometries) Creates a geometry query for shape docvaluesint
Returns the number of terms (tessellated triangles) for this shaperelate
(Component2D component) protected static int
vIntSize
(int i) Computes the variable Integer size in bytesprotected static int
vLongSize
(long i) Computes the variable Long size in bytes
-
Field Details
-
VERSION
protected static final byte VERSIONdoc value format version; used to support bwc for any encoding changes- See Also:
-
data
the binary doc value -
shapeComparator
the geometry comparator used to check relations -
centroid
the centroid of the shape docvalue -
boundingBox
the bounding box of the shape docvalue
-
-
Constructor Details
-
ShapeDocValues
ShapeDocValues(List<ShapeField.DecodedTriangle> tessellation) Creates a instance from a shape tessellation- Parameters:
tessellation
- The tessellation (must not be null)
-
ShapeDocValues
ShapeDocValues(BytesRef binaryValue) Creates aShapeDocValues
instance from a given serialized value
-
-
Method Details
-
binaryValue
returns the encoded doc values field as aBytesRef
-
numberOfTerms
public int numberOfTerms()Returns the number of terms (tessellated triangles) for this shape -
getEncodedMinX
public int getEncodedMinX()returns the min x value for the shape's bounding box -
getEncodedMinY
public int getEncodedMinY()returns the min y value for the shape's bounding box -
getEncodedMaxX
public int getEncodedMaxX()returns the max x value for the shape's bounding box -
getEncodedMaxY
public int getEncodedMaxY()returns the max y value for the shape's bounding box -
getEncodedCentroidX
protected int getEncodedCentroidX()Retrieves the encoded x centroid location for the geometry(s) -
getEncodedCentroidY
protected int getEncodedCentroidY()Retrieves the encoded y centroid location for the geometry(s) -
getHighestDimension
Retrieves the highest dimensional type (POINT, LINE, TRIANGLE) for computing the geometry(s) centroid -
computeBinaryValue
-
newGeometryQuery
public static Query newGeometryQuery(String field, ShapeField.QueryRelation relation, Object... geometries) Creates a geometry query for shape docvalues -
relate
- Throws:
IOException
-
getEncoder
-
computeCentroid
-
computeBoundingBox
-
getCentroid
-
getBoundingBox
-
buildTree
private ShapeDocValues.TreeNode buildTree(List<ShapeField.DecodedTriangle> tessellation, List<ShapeDocValues.TreeNode> dfsSerialized) throws IOException main entry point to build the tessellation tree *- Throws:
IOException
-
createTree
private ShapeDocValues.TreeNode createTree(ShapeDocValues.TreeNode[] triangles, int low, int high, boolean splitX, ShapeDocValues.TreeNode parent, List<ShapeDocValues.TreeNode> dfsSerialized) creates the tree -
computeComponentSize
-
vLongSize
protected static int vLongSize(long i) Computes the variable Long size in bytes -
vIntSize
protected static int vIntSize(int i) Computes the variable Integer size in bytes
-