Buggy code:
public class DirectoryTaxonomyReader implements TaxonomyReader { private static final Logger logger = Logger . getLogger ( DirectoryTaxonomyReader . class . getName ( ) ) ; private DirectoryReader indexReader ; private ReadWriteLock indexReaderLock = new ReentrantReadWriteLock ( ) ; private final LRUHashMap < String , Integer > ordinalCache ; private final LRUHashMap < Integer , String > categoryCache ; private ParentArray parentArray ; private char delimiter = Consts . DEFAULT_DELIMITER ; private volatile boolean closed = false ; private final AtomicInteger refCount = new AtomicInteger ( 1 ) ; public DirectoryTaxonomyReader ( Directory directory ) throws IOException { } protected DirectoryReader openIndexReader ( Directory directory ) throws IOException { } protected final void ensureOpen ( ) throws AlreadyClosedException { } public void setCacheSize ( int size ) { } public void setDelimiter ( char delimiter ) { } public int getOrdinal ( CategoryPath categoryPath ) throws IOException { ensureOpen ( ) ; if ( ( categoryPath . length ( ) ) == 0 ) { return ROOT_ORDINAL ; } String path = categoryPath . toString ( delimiter ) ; synchronized ( ordinalCache ) { Integer res = ordinalCache . get ( path ) ; if ( res != null ) { return res . intValue ( ) ; } } int ret = TaxonomyReader . INVALID_ORDINAL ; try { indexReaderLock . readLock ( ) . lock ( ) ; Bits liveDocs = MultiFields . getLiveDocs ( indexReader ) ; <START_BUG> DocsEnum docs = MultiFields . getTermDocsEnum ( indexReader , liveDocs , FULL , new BytesRef ( path ) , 0 ) ; <END_BUG> if ( ( docs != null ) && ( ( docs . nextDoc ( ) ) != ( DocIdSetIterator . NO_MORE_DOCS ) ) ) { ret = docs . docID ( ) ; } } finally { indexReaderLock . readLock ( ) . unlock ( ) ; } synchronized ( ordinalCache ) { ordinalCache . put ( path , Integer . valueOf ( ret ) ) ; } return ret ; } public CategoryPath getPath ( int ordinal ) throws IOException { } public boolean getPath ( int ordinal , CategoryPath result ) throws IOException { } private String getLabel ( int catID ) throws IOException { } public int getParent ( int ordinal ) { } public int [ ] getParentArray ( ) { } public synchronized boolean refresh ( ) throws IOException , InconsistentTaxonomyException { } public void close ( ) throws IOException { } private void doClose ( ) throws IOException { } public int getSize ( ) { } public Map < String , String > getCommitUserData ( ) throws IOException { } private ChildrenArrays childrenArrays ; Object childrenArraysRebuild = new Object ( ) ; public ChildrenArrays getChildrenArrays ( ) { } public String toString ( int max ) { } private static final class ChildrenArraysImpl implements ChildrenArrays { private int [ ] youngestChildArray ; private int [ ] olderSiblingArray ; public ChildrenArraysImpl ( int [ ] youngestChildArray , int [ ] olderSiblingArray ) { } public int [ ] getOlderSiblingArray ( ) { } public int [ ] getYoungestChildArray ( ) { } } DirectoryReader getInternalIndexReader ( ) { } public void decRef ( ) throws IOException { } public int getRefCount ( ) { } public void incRef ( ) { } }

Fix:
DocsEnum docs = MultiFields . getTermDocsEnum ( indexReader , liveDocs , FULL , new BytesRef ( path ) , false ) ;