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
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
ConstructorsConstructorDescriptionReindexingEnrichedDirectoryTaxonomyWriter
(Directory d, BiConsumer<FacetLabel, Document> ordinalDataAppender) Create a taxonomy writer that will allow editing the ordinal docs before indexing them. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 Details
-
ReindexingEnrichedDirectoryTaxonomyWriter
public ReindexingEnrichedDirectoryTaxonomyWriter(Directory d, BiConsumer<FacetLabel, Document> ordinalDataAppender) throws IOExceptionCreate a taxonomy writer that will allow editing the ordinal docs before indexing them.- Throws:
IOException
-
-
Method Details
-
enrichOrdinalDocument
Add fields specified by theordinalDataAppender
to the providedDocument
.- Overrides:
enrichOrdinalDocument
in classDirectoryTaxonomyWriter
-
reindexWithNewOrdinalData
public void reindexWithNewOrdinalData(BiConsumer<FacetLabel, Document> ordinalDataAppender) throws IOExceptionDelete 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
-