org.apache.lucene.util.bkd

## Class BKDReader

- java.lang.Object
- - org.apache.lucene.index.PointValues
  - - org.apache.lucene.util.bkd.BKDReader

- All Implemented Interfaces:
    Accountable

      public final class BKDReader
      extends PointValues
      implements Accountable

  Handles intersection of an multi-dimensional shape in byte[] space with a block KD-tree previously written with `BKDWriter`.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `BKDReader.IndexTree` Used to walk the in-heap index
    `static class` | `BKDReader.IntersectState` Used to track all state for a single call to `intersect(org.apache.lucene.index.PointValues.IntersectVisitor)`.

    - ### Nested classes/interfaces inherited from class org.apache.lucene.index.PointValues

      `PointValues.IntersectVisitor, PointValues.Relation`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `packedBytesLength`
    `protected int` | `packedIndexBytesLength`

    - ### Fields inherited from class org.apache.lucene.index.PointValues

      `MAX_DIMENSIONS, MAX_NUM_BYTES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BKDReader(IndexInput in)` Caller must pre-seek the provided `IndexInput` to the index location that `BKDWriter.finish(org.apache.lucene.store.IndexOutput)` returned

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `estimatePointCount(PointValues.IntersectVisitor visitor)` Estimate the number of points that would be visited by `PointValues.intersect(org.apache.lucene.index.PointValues.IntersectVisitor)` with the given `PointValues.IntersectVisitor`.
    `int` | `getBytesPerDimension()` Returns the number of bytes per dimension
    `int` | `getDocCount()` Returns the total number of documents that have indexed at least one point.
    `BKDReader.IntersectState` | `getIntersectState(PointValues.IntersectVisitor visitor)` Create a new `BKDReader.IntersectState`
    `byte[]` | `getMaxPackedValue()` Returns maximum value for each dimension, packed, or null if `PointValues.size(org.apache.lucene.index.IndexReader, java.lang.String)` is `0`
    `byte[]` | `getMinPackedValue()` Returns minimum value for each dimension, packed, or null if `PointValues.size(org.apache.lucene.index.IndexReader, java.lang.String)` is `0`
    `int` | `getNumDataDimensions()` Returns how many data dimensions are represented in the values
    `int` | `getNumIndexDimensions()` Returns how many dimensions are used for the index
    `void` | `intersect(PointValues.IntersectVisitor visitor)` Finds all documents and points matching the provided visitor.
    `boolean` | `isLeafNode(int nodeID)`
    `long` | `ramBytesUsed()` Return the memory usage of this object in bytes.
    `long` | `size()` Returns the total number of indexed points across all documents.
    `void` | `visitLeafBlockValues(BKDReader.IndexTree index, BKDReader.IntersectState state)` Visits all docIDs and packed values in a single leaf block

    - ### Methods inherited from class org.apache.lucene.index.PointValues

      `getDocCount, getMaxPackedValue, getMinPackedValue, size`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.lucene.util.Accountable

      `getChildResources`

- - ### Field Detail

    - #### packedBytesLength

          protected final int packedBytesLength

    - #### packedIndexBytesLength

          protected final int packedIndexBytesLength

  - ### Constructor Detail

    - #### BKDReader

          public BKDReader(IndexInput in)
                    throws IOException

      Caller must pre-seek the provided `IndexInput` to the index location that `BKDWriter.finish(org.apache.lucene.store.IndexOutput)` returned
      Throws:
        `IOException`

  - ### Method Detail

    - #### intersect

          public void intersect(PointValues.IntersectVisitor visitor)
                         throws IOException

      Description copied from class: `PointValues`
      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.
      Specified by:
        `intersect` in class `PointValues`
      Throws:
        `IOException`

    - #### estimatePointCount

          public long estimatePointCount(PointValues.IntersectVisitor visitor)

      Description copied from class: `PointValues`
      Estimate the number of points that would be visited by `PointValues.intersect(org.apache.lucene.index.PointValues.IntersectVisitor)` with the given `PointValues.IntersectVisitor`. This should run many times faster than `PointValues.intersect(IntersectVisitor)`.
      Specified by:
        `estimatePointCount` in class `PointValues`
      See Also:
        `DocIdSetIterator.cost()`

    - #### getIntersectState

          public BKDReader.IntersectState getIntersectState(PointValues.IntersectVisitor visitor)

      Create a new `BKDReader.IntersectState`

    - #### visitLeafBlockValues

          public void visitLeafBlockValues(BKDReader.IndexTree index,
                                           BKDReader.IntersectState state)
                                    throws IOException

      Visits all docIDs and packed values in a single leaf block
      Throws:
        `IOException`

    - #### ramBytesUsed

          public long ramBytesUsed()

      Description copied from interface: `Accountable`
      Return the memory usage of this object in bytes. Negative values are illegal.
      Specified by:
        `ramBytesUsed` in interface `Accountable`

    - #### getMinPackedValue

          public byte[] getMinPackedValue()

      Description copied from class: `PointValues`
      Returns minimum value for each dimension, packed, or null if `PointValues.size(org.apache.lucene.index.IndexReader, java.lang.String)` is `0`
      Specified by:
        `getMinPackedValue` in class `PointValues`

    - #### getMaxPackedValue

          public byte[] getMaxPackedValue()

      Description copied from class: `PointValues`
      Returns maximum value for each dimension, packed, or null if `PointValues.size(org.apache.lucene.index.IndexReader, java.lang.String)` is `0`
      Specified by:
        `getMaxPackedValue` in class `PointValues`

    - #### getNumDataDimensions

          public int getNumDataDimensions()

      Description copied from class: `PointValues`
      Returns how many data dimensions are represented in the values
      Specified by:
        `getNumDataDimensions` in class `PointValues`

    - #### getNumIndexDimensions

          public int getNumIndexDimensions()

      Description copied from class: `PointValues`
      Returns how many dimensions are used for the index
      Specified by:
        `getNumIndexDimensions` in class `PointValues`

    - #### getBytesPerDimension

          public int getBytesPerDimension()

      Description copied from class: `PointValues`
      Returns the number of bytes per dimension
      Specified by:
        `getBytesPerDimension` in class `PointValues`

    - #### size

          public long size()

      Description copied from class: `PointValues`
      Returns the total number of indexed points across all documents.
      Specified by:
        `size` in class `PointValues`

    - #### getDocCount

          public int getDocCount()

      Description copied from class: `PointValues`
      Returns the total number of documents that have indexed at least one point.
      Specified by:
        `getDocCount` in class `PointValues`

    - #### isLeafNode

          public boolean isLeafNode(int nodeID)

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.