org.apache.lucene.rangetree

## Class RangeTreeDocValuesFormat

- java.lang.Object
- - org.apache.lucene.codecs.DocValuesFormat
  - - org.apache.lucene.rangetree.RangeTreeDocValuesFormat

- All Implemented Interfaces:
    NamedSPILoader.NamedSPI

      public class RangeTreeDocValuesFormat
      extends DocValuesFormat

  A `DocValuesFormat` to efficiently index numeric values from from `SortedNumericDocValuesField` or BytesRef values from `SortedSetDocValuesField` for numeric range queries using (`NumericRangeTreeQuery`) and arbitrary binary range queries using `SortedSetRangeTreeQuery`.

  This wraps `Lucene54DocValuesFormat`, but saves its own numeric tree structures to disk for fast query-time intersection. See this paper for details.

  The numeric tree slices up 1D space into smaller and smaller ranges, until the smallest ranges have approximately between X/2 and X (X default is 1024) values in them, at which point such leaf cells are written as a block to disk, while the index tree structure records how space was sub-divided is loaded into HEAP at search time. At search time, the tree is recursed based on whether each of left or right child overlap with the query range, and once a leaf block is reached, all documents in that leaf block are collected if the cell is fully enclosed by the query shape, or filtered and then collected, if not.

  The index is also quite compact, because docs only appear once in the tree (no "prefix terms").

  In addition to the files written by `Lucene54DocValuesFormat`, this format writes:

  1. `.ndd`: numeric tree leaf data and index
  2. `.ndm`: numeric tree metadata

  The disk format is experimental and free to change suddenly, and this code likely has new and exciting bugs!

  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RangeTreeDocValuesFormat()` Default constructor
    `RangeTreeDocValuesFormat(int maxPointsInLeafNode, int maxPointsSortInHeap)` Creates this with custom configuration.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `DocValuesConsumer` | `fieldsConsumer(SegmentWriteState state)`
    `DocValuesProducer` | `fieldsProducer(SegmentReadState state)`

    - ### Methods inherited from class org.apache.lucene.codecs.DocValuesFormat

      `availableDocValuesFormats, forName, getName, reloadDocValuesFormats, toString`

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

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

- - ### Constructor Detail

    - #### RangeTreeDocValuesFormat

          public RangeTreeDocValuesFormat()

      Default constructor

    - #### RangeTreeDocValuesFormat

          public RangeTreeDocValuesFormat(int maxPointsInLeafNode,
                                  int maxPointsSortInHeap)

      Creates this with custom configuration.
      Parameters:
        `maxPointsInLeafNode` - Maximum number of points in each leaf cell. Smaller values create a deeper tree with larger in-heap index and possibly faster searching. The default is 1024.
        `maxPointsSortInHeap` - Maximum number of points where in-heap sort can be used. When the number of points exceeds this, a (slower) offline sort is used. The default is 128 * 1024.
      WARNING: This API is experimental and might change in incompatible ways in the next release.

  - ### Method Detail

    - #### fieldsConsumer

          public DocValuesConsumer fieldsConsumer(SegmentWriteState state)
                                           throws IOException

      Specified by:
        `fieldsConsumer` in class `DocValuesFormat`
      Throws:
        `IOException`

    - #### fieldsProducer

          public DocValuesProducer fieldsProducer(SegmentReadState state)
                                           throws IOException

      Specified by:
        `fieldsProducer` in class `DocValuesFormat`
      Throws:
        `IOException`

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