org.apache.lucene.util
Class ReaderUtil

java.lang.Object
  extended by org.apache.lucene.util.ReaderUtil

public final class ReaderUtil
extends Object

Common util methods for dealing with IndexReaders.

NOTE: This API is for Lucene internal purposes only and might change in incompatible ways in the next release.

Nested Class Summary
static class ReaderUtil.Gather
          Recursively visits all sub-readers of a reader.
 
Method Summary
static void gatherSubReaders(List<IndexReader> allSubReaders, IndexReader reader)
          Gathers sub-readers from reader into a List.
static int subIndex(int n, int[] docStarts)
          Returns index of the searcher/reader for document n in the array used to construct this searcher/reader.
static IndexReader subReader(IndexReader reader, int subIndex)
          Returns sub-reader subIndex from reader.
static IndexReader subReader(int doc, IndexReader reader)
          Returns sub IndexReader that contains the given document id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

gatherSubReaders

public static void gatherSubReaders(List<IndexReader> allSubReaders,
                                    IndexReader reader)
Gathers sub-readers from reader into a List.

Parameters:
allSubReaders -
reader -

subReader

public static IndexReader subReader(int doc,
                                    IndexReader reader)
Returns sub IndexReader that contains the given document id.

Parameters:
doc - id of document
reader - parent reader
Returns:
sub reader of parent which contains the specified doc id

subReader

public static IndexReader subReader(IndexReader reader,
                                    int subIndex)
Returns sub-reader subIndex from reader.

Parameters:
reader - parent reader
subIndex - index of desired sub reader
Returns:
the subreader at subIndex

subIndex

public static int subIndex(int n,
                           int[] docStarts)
Returns index of the searcher/reader for document n in the array used to construct this searcher/reader.



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