LUCENE-4152: add one syllable method to enumerate subreaders

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1372645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-08-13 22:03:16 +00:00
parent f1969b13c7
commit 0e9d4c7459
2 changed files with 12 additions and 0 deletions

View File

@ -31,6 +31,10 @@ API Changes
and exposes Iterator, so you can iterate over field names with and exposes Iterator, so you can iterate over field names with
for (String field : fields) instead. (Robert Muir) for (String field : fields) instead. (Robert Muir)
* LUCENE-4152: added IndexReader.leaves(), which lets you enumerate
the leaf atomic reader contexts for all readers in the tree.
(Uwe Schindler, Robert Muir)
Bug Fixes Bug Fixes
* LUCENE-4297: BooleanScorer2 would multiply the coord() factor * LUCENE-4297: BooleanScorer2 would multiply the coord() factor

View File

@ -21,6 +21,7 @@ import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -396,6 +397,13 @@ public abstract class IndexReader implements Closeable {
* @lucene.experimental * @lucene.experimental
*/ */
public abstract IndexReaderContext getTopReaderContext(); public abstract IndexReaderContext getTopReaderContext();
/**
* Returns the reader's leaves, or itself if this reader is Atomic.
*/
public final List<AtomicReaderContext> leaves() {
return getTopReaderContext().leaves();
}
/** Expert: Returns a key for this IndexReader, so FieldCache/CachingWrapperFilter can find /** Expert: Returns a key for this IndexReader, so FieldCache/CachingWrapperFilter can find
* it again. * it again.