ReindexingEnrichedDirectoryTaxonomyWriter (Lucene 10.5.1 facet API)
Description: declaration: package: org.apache.lucene.facet.taxonomy.directory, class: ReindexingEnrichedDirectoryTaxonomyWriter

Package org.apache.lucene.facet.taxonomy.directory

# Class ReindexingEnrichedDirectoryTaxonomyWriter

java.lang.Object
org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter
org.apache.lucene.facet.taxonomy.directory.ReindexingEnrichedDirectoryTaxonomyWriter

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `TaxonomyWriter`, `TwoPhaseCommit`

public class ReindexingEnrichedDirectoryTaxonomyWriter extends DirectoryTaxonomyWriter
Use this `TaxonomyWriter` to append arbitrary fields to the ordinal documents in the taxonomy. To update the custom data added to the docs, it is required to `reindexWithNewOrdinalData(BiConsumer)`.

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

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter

  `DirectoryTaxonomyWriter.DiskOrdinalMap, DirectoryTaxonomyWriter.MemoryOrdinalMap, DirectoryTaxonomyWriter.OrdinalMap`

- ## Field Summary

  ### Fields inherited from class org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter

  `INDEX_EPOCH`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ReindexingEnrichedDirectoryTaxonomyWriter(Directory d, BiConsumer<FacetLabel,Document> ordinalDataAppender)`
  Create a taxonomy writer that will allow editing the ordinal docs before indexing them.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `enrichOrdinalDocument(Document d, FacetLabel categoryPath)`
  Add fields specified by the `ordinalDataAppender` to the provided `Document`.
  `void`
  `reindexWithNewOrdinalData(BiConsumer<FacetLabel,Document> ordinalDataAppender)`
  Delete the existing taxonomy index and recreate it using new ordinal data.

  ### Methods inherited from class org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter

  `addCategory, addTaxonomy, close, closeResources, commit, createIndexWriterConfig, defaultTaxonomyWriterCache, ensureOpen, findCategory, getCache, getDirectory, getLiveCommitData, getParent, getSize, getTaxonomyEpoch, openIndexWriter, prepareCommit, replaceTaxonomy, rollback, setCacheMissesUntilFill, setLiveCommitData`

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

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

- ## Constructor Details

  - ### ReindexingEnrichedDirectoryTaxonomyWriter

    public ReindexingEnrichedDirectoryTaxonomyWriter(Directory d, BiConsumer<FacetLabel,Document> ordinalDataAppender) throws IOException
    Create a taxonomy writer that will allow editing the ordinal docs before indexing them.
    Throws:
      `IOException`

- ## Method Details

  - ### enrichOrdinalDocument

    protected void enrichOrdinalDocument(Document d, FacetLabel categoryPath)
    Add fields specified by the `ordinalDataAppender` to the provided `Document`.
    Overrides:
      `enrichOrdinalDocument` in class `DirectoryTaxonomyWriter`

  - ### reindexWithNewOrdinalData

    public void reindexWithNewOrdinalData(BiConsumer<FacetLabel,Document> ordinalDataAppender) throws IOException
    Delete the existing taxonomy index and recreate it using new ordinal data. The ordinals themselves will be preserved, so the caller does not need to update references to them in the main index.
    Throws:
      `IOException`