Package org.apache.lucene.index
Class PointValues
- java.lang.Object
- 
- org.apache.lucene.index.PointValues
 
- 
- Direct Known Subclasses:
- BKDReader
 
 public abstract class PointValues extends Object Access to indexed numeric values.Points represent numeric values and are indexed differently than ordinary text. Instead of an inverted index, points are indexed with datastructures such as KD-trees. These structures are optimized for operations such as range, distance, nearest-neighbor, and point-in-polygon queries. Basic Point Types
 * in the lucene-sandbox jarBasic point types in Java and Lucene Java type Lucene class intIntPointlongLongPointfloatFloatPointdoubleDoublePointbyte[]BinaryPointInetAddressInetAddressPointBigIntegerBigIntegerPoint* 
 Basic Lucene point types behave like their java peers: for example IntPointrepresents a signed 32-bitInteger, supporting values ranging fromInteger.MIN_VALUEtoInteger.MAX_VALUE, ordered consistent withInteger.compareTo(Integer). In addition to indexing support, point classes also contain static methods (such asIntPoint.newRangeQuery(String, int, int)) for creating common queries. For example:// add year 1970 to document document.add(new IntPoint("year", 1970)); // index document writer.addDocument(document); ... // issue range query of 1960-1980 Query query = IntPoint.newRangeQuery("year", 1960, 1980); TopDocs docs = searcher.search(query, ...);Geospatial Point TypesAlthough basic point types such asDoublePointsupport points in multi-dimensional space too, Lucene has specialized classes for location data. These classes are optimized for location data: they are more space-efficient and support special operations such as distance and polygon queries. There are currently two implementations:
 - LatLonPoint: indexes- (latitude,longitude)as- (x,y)in two-dimensional space.
- Geo3DPoint*
       in lucene-spatial3d: indexes (latitude,longitude)as(x,y,z)in three-dimensional space.
 
 Advanced usageCustom structures can be created on top of single- or multi- dimensional basic types, on top ofBinaryPointfor more flexibility, or via customFieldsubclasses.- WARNING: This API is experimental and might change in incompatible ways in the next release.
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfacePointValues.IntersectVisitorWe recurse thePointValues.PointTree, using a provided instance of this to guide the recursion.static interfacePointValues.PointTreeBasic operations to read the KD-tree.static classPointValues.RelationUsed byintersect(org.apache.lucene.index.PointValues.IntersectVisitor)to check how each recursive cell corresponds to the query.
 - 
Field SummaryFields Modifier and Type Field Description static intMAX_DIMENSIONSMaximum number of dimensionsstatic intMAX_INDEX_DIMENSIONSMaximum number of index dimensionsstatic intMAX_NUM_BYTESMaximum number of bytes for each dimension
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedPointValues()Default constructor
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description longestimateDocCount(PointValues.IntersectVisitor visitor)Estimate the number of documents that would be matched byintersect(org.apache.lucene.index.PointValues.IntersectVisitor)with the givenPointValues.IntersectVisitor.longestimatePointCount(PointValues.IntersectVisitor visitor)Estimate the number of points that would be visited byintersect(org.apache.lucene.index.PointValues.IntersectVisitor)with the givenPointValues.IntersectVisitor.abstract intgetBytesPerDimension()Returns the number of bytes per dimensionabstract intgetDocCount()Returns the total number of documents that have indexed at least one point.static intgetDocCount(IndexReader reader, String field)Return the cumulated number of docs that have points across all leaves of the givenIndexReader.abstract byte[]getMaxPackedValue()Returns maximum value for each dimension, packed, or null ifsize(org.apache.lucene.index.IndexReader, java.lang.String)is0static byte[]getMaxPackedValue(IndexReader reader, String field)Return the maximum packed values across all leaves of the givenIndexReader.abstract byte[]getMinPackedValue()Returns minimum value for each dimension, packed, or null ifsize(org.apache.lucene.index.IndexReader, java.lang.String)is0static byte[]getMinPackedValue(IndexReader reader, String field)Return the minimum packed values across all leaves of the givenIndexReader.abstract intgetNumDimensions()Returns how many dimensions are represented in the valuesabstract intgetNumIndexDimensions()Returns how many dimensions are used for the indexabstract PointValues.PointTreegetPointTree()Create a newPointValues.PointTreeto navigate the indexvoidintersect(PointValues.IntersectVisitor visitor)Finds all documents and points matching the provided visitor.abstract longsize()Returns the total number of indexed points across all documents.static longsize(IndexReader reader, String field)Return the cumulated number of points across all leaves of the givenIndexReader.
 
- 
- 
- 
Field Detail- 
MAX_NUM_BYTESpublic static final int MAX_NUM_BYTES Maximum number of bytes for each dimension- See Also:
- Constant Field Values
 
 - 
MAX_DIMENSIONSpublic static final int MAX_DIMENSIONS Maximum number of dimensions- See Also:
- Constant Field Values
 
 - 
MAX_INDEX_DIMENSIONSpublic static final int MAX_INDEX_DIMENSIONS Maximum number of index dimensions- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
sizepublic static long size(IndexReader reader, String field) throws IOException Return the cumulated number of points across all leaves of the givenIndexReader. Leaves that do not have points for the given field are ignored.- Throws:
- IOException
- See Also:
- size()
 
 - 
getDocCountpublic static int getDocCount(IndexReader reader, String field) throws IOException Return the cumulated number of docs that have points across all leaves of the givenIndexReader. Leaves that do not have points for the given field are ignored.- Throws:
- IOException
- See Also:
- getDocCount()
 
 - 
getMinPackedValuepublic static byte[] getMinPackedValue(IndexReader reader, String field) throws IOException Return the minimum packed values across all leaves of the givenIndexReader. Leaves that do not have points for the given field are ignored.- Throws:
- IOException
- See Also:
- getMinPackedValue()
 
 - 
getMaxPackedValuepublic static byte[] getMaxPackedValue(IndexReader reader, String field) throws IOException Return the maximum packed values across all leaves of the givenIndexReader. Leaves that do not have points for the given field are ignored.- Throws:
- IOException
- See Also:
- getMaxPackedValue()
 
 - 
getPointTreepublic abstract PointValues.PointTree getPointTree() throws IOException Create a newPointValues.PointTreeto navigate the index- Throws:
- IOException
 
 - 
intersectpublic final void intersect(PointValues.IntersectVisitor visitor) throws IOException Finds all documents and points matching the provided visitor. This method does not enforce live documents, so it's up to the caller to test whether each document is deleted, if necessary.- Throws:
- IOException
 
 - 
estimatePointCountpublic final long estimatePointCount(PointValues.IntersectVisitor visitor) Estimate the number of points that would be visited byintersect(org.apache.lucene.index.PointValues.IntersectVisitor)with the givenPointValues.IntersectVisitor. This should run many times faster thanintersect(IntersectVisitor).
 - 
estimateDocCountpublic final long estimateDocCount(PointValues.IntersectVisitor visitor) Estimate the number of documents that would be matched byintersect(org.apache.lucene.index.PointValues.IntersectVisitor)with the givenPointValues.IntersectVisitor. This should run many times faster thanintersect(IntersectVisitor).- See Also:
- DocIdSetIterator.cost()
 
 - 
getMinPackedValuepublic abstract byte[] getMinPackedValue() throws IOExceptionReturns minimum value for each dimension, packed, or null ifsize(org.apache.lucene.index.IndexReader, java.lang.String)is0- Throws:
- IOException
 
 - 
getMaxPackedValuepublic abstract byte[] getMaxPackedValue() throws IOExceptionReturns maximum value for each dimension, packed, or null ifsize(org.apache.lucene.index.IndexReader, java.lang.String)is0- Throws:
- IOException
 
 - 
getNumDimensionspublic abstract int getNumDimensions() throws IOExceptionReturns how many dimensions are represented in the values- Throws:
- IOException
 
 - 
getNumIndexDimensionspublic abstract int getNumIndexDimensions() throws IOExceptionReturns how many dimensions are used for the index- Throws:
- IOException
 
 - 
getBytesPerDimensionpublic abstract int getBytesPerDimension() throws IOExceptionReturns the number of bytes per dimension- Throws:
- IOException
 
 - 
sizepublic abstract long size() Returns the total number of indexed points across all documents.
 - 
getDocCountpublic abstract int getDocCount() Returns the total number of documents that have indexed at least one point.
 
- 
 
-