Class FacetUtils

java.lang.Object
org.apache.lucene.facet.FacetUtils

public final class FacetUtils extends Object
Utility class with a single method for getting a DocIdSetIterator that skips deleted docs
WARNING: This API is experimental and might change in incompatible ways in the next release.
  • Method Details

    • liveDocsDISI

      public static DocIdSetIterator liveDocsDISI(DocIdSetIterator it, Bits liveDocs)
      Wrap the given DocIdSetIterator and liveDocs into another DocIdSetIterator that returns non-deleted documents during iteration. This is useful for computing facet counts on match-all style queries that need to exclude deleted documents.

      ConjunctionUtils could be better home for this method if we can identify use cases outside facets module.

      Making this class pkg-private unfortunately limits the visibility of this method to SortedSetDocValuesFacetCounts and ConcurrentSortedSetDocValuesFacetCounts classes as Java does not allow pkg-private classes to be visible to sub-packages.

      Parameters:
      it - DocIdSetIterator being wrapped
      liveDocs - Bits containing set bits for non-deleted docs
      Returns:
      wrapped iterator
    • loadOrdinalValues

      @Deprecated public static SortedNumericDocValues loadOrdinalValues(LeafReader reader, String fieldName) throws IOException
      Deprecated.
      Please do not rely on this method. It is added as a temporary measure for providing index backwards-compatibility with Lucene 8 and earlier indexes, and will be removed in Lucene 10.
      Loads ordinal values as SortedNumericDocValues. If the index still uses the older binary format, it will wrap that with the SNDV API. Newer format indexes will just load the SNDV directly.

      This is really only needed/useful to maintain back-compat with the binary format. Once back-compat is no longer needed, the SNDV field should just be loaded directly.

      Throws:
      IOException
    • loadOrdinalValues

      @Deprecated public static SortedNumericDocValues loadOrdinalValues(LeafReader reader, String fieldName, BiConsumer<BytesRef,IntsRef> binaryValueDecoder) throws IOException
      Deprecated.
      Please do not rely on this method. It is added as a temporary measure for providing index backwards-compatibility with Lucene 8 and earlier indexes, and will be removed in Lucene 10.
      Loads ordinal values as SortedNumericDocValues. If the index still uses the older binary format, it will wrap that with the SNDV API. Newer format indexes will just load the SNDV directly. The provided binaryValueDecoder allows custom decoding logic for older binary format fields to be provided.

      This is really only needed/useful to maintain back-compat with the binary format. Once back-compat is no longer needed, the SNDV field should just be loaded directly.

      Throws:
      IOException