Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.facet.util
Class OrdinalMappingAtomicReader

    java.lang.Object
      org.apache.lucene.index.IndexReader
          org.apache.lucene.index.AtomicReader
              org.apache.lucene.index.FilterAtomicReader
                  org.apache.lucene.facet.util.OrdinalMappingAtomicReader

All Implemented Interfaces:
  Closeable

    public class OrdinalMappingAtomicReader

extends FilterAtomicReader

A `FilterAtomicReader` for updating facets ordinal references, based on an ordinal map. You should use this code in conjunction with merging taxonomies - after you merge taxonomies, you receive an `DirectoryTaxonomyWriter.OrdinalMap` which maps the 'old' ordinals to the 'new' ones. You can use that map to re-map the doc values which contain the facets information (ordinals) either before or while merging the indexes.

For re-mapping the ordinals during index merge, do the following:

     // merge the old taxonomy with the new one.
     OrdinalMap map = new MemoryOrdinalMap();
     DirectoryTaxonomyWriter.addTaxonomy(srcTaxoDir, map);
     int[] ordmap = map.getMap();

     // Add the index and re-map ordinals on the go
     DirectoryReader reader = DirectoryReader.open(oldDir);
     IndexWriterConfig conf = new IndexWriterConfig(VER, ANALYZER);
     IndexWriter writer = new IndexWriter(newDir, conf);
     List<AtomicReaderContext> leaves = reader.leaves();
       AtomicReader wrappedLeaves[] = new AtomicReader[leaves.size()];
       for (int i = 0; i < leaves.size(); i++) {
         wrappedLeaves[i] = new OrdinalMappingAtomicReader(leaves.get(i).reader(), ordmap);
       }
     writer.addIndexes(new MultiReader(wrappedLeaves));
     writer.commit();

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.index.FilterAtomicReader
`FilterAtomicReader.FilterDocsAndPositionsEnum, FilterAtomicReader.FilterDocsEnum, FilterAtomicReader.FilterFields, FilterAtomicReader.FilterTerms, FilterAtomicReader.FilterTermsEnum`

Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
`IndexReader.ReaderClosedListener`

Field Summary

Fields inherited from class org.apache.lucene.index.FilterAtomicReader
`in`

Constructor Summary
`OrdinalMappingAtomicReader(AtomicReader in, int[] ordinalMap)` Wraps an AtomicReader, mapping ordinals according to the ordinalMap.
`OrdinalMappingAtomicReader(AtomicReader in, int[] ordinalMap, FacetIndexingParams indexingParams)` Wraps an AtomicReader, mapping ordinals according to the ordinalMap, using the provided indexingParams.

Method Summary
`BinaryDocValues` | `getBinaryDocValues(String field)`

Methods inherited from class org.apache.lucene.index.FilterAtomicReader
`doClose, document, fields, getFieldInfos, getLiveDocs, getNormValues, getNumericDocValues, getSortedDocValues, getSortedSetDocValues, getTermVectors, maxDoc, numDocs, toString`

Methods inherited from class org.apache.lucene.index.AtomicReader
`docFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, hasNorms, termDocsEnum, termPositionsEnum, terms, totalTermFreq`

Methods inherited from class org.apache.lucene.index.IndexReader
`addReaderClosedListener, close, decRef, document, document, ensureOpen, equals, getCombinedCoreAndDeletesKey, getCoreCacheKey, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, open, open, open, open, open, registerParentReader, removeReaderClosedListener, tryIncRef`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### OrdinalMappingAtomicReader

    public OrdinalMappingAtomicReader(AtomicReader in,
                                      int[] ordinalMap)

  Wraps an AtomicReader, mapping ordinals according to the ordinalMap. Calls `OrdinalMappingAtomicReader(in, ordinalMap, new DefaultFacetIndexingParams())`

### OrdinalMappingAtomicReader

    public OrdinalMappingAtomicReader(AtomicReader in,
                                      int[] ordinalMap,
                                      FacetIndexingParams indexingParams)

  Wraps an AtomicReader, mapping ordinals according to the ordinalMap, using the provided indexingParams.

Method Detail

### getBinaryDocValues

    public BinaryDocValues getBinaryDocValues(String field)
                                       throws IOException

  Overrides:
    `getBinaryDocValues` in class `FilterAtomicReader`
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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