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 thisTaxonomyWriter
to append arbitrary fields to the ordinal documents in the taxonomy. To update the custom data added to the docs, it is required toreindexWithNewOrdinalData(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
enrichOrdinalDocument(Document d, FacetLabel categoryPath)
Add fields specified by theordinalDataAppender
to the providedDocument
.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, useNumericDocValuesForOrdinals
-
-
-
-
Constructor Detail
-
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 Detail
-
enrichOrdinalDocument
protected void enrichOrdinalDocument(Document d, FacetLabel categoryPath)
Add fields specified by theordinalDataAppender
to the providedDocument
.- Overrides:
enrichOrdinalDocument
in classDirectoryTaxonomyWriter
-
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
-
-