org.apache.lucene.index

Class MultiReader


public class MultiReader
extends IndexReader

An IndexReader which reads multiple indexes, appending their content.
Version:
$Id: MultiReader.java,v 1.7 2004/05/17 12:56:47 goller Exp $

Constructor Summary

MultiReader(IndexReader[] subReaders)
Construct a MultiReader aggregating the named set of (sub)readers.

Method Summary

protected void
doClose()
protected void
doCommit()
protected void
doDelete(int n)
protected void
doSetNorm(int n, String field, byte value)
protected void
doUndeleteAll()
int
docFreq(Term t)
Document
document(int n)
Collection
getFieldNames()
Collection
getFieldNames(boolean indexed)
Collection
getIndexedFieldNames(boolean storedTermVector)
TermFreqVector
getTermFreqVector(int n, String field)
TermFreqVector[]
getTermFreqVectors(int n)
Return an array of term frequency vectors for the specified document.
boolean
hasDeletions()
boolean
isDeleted(int n)
int
maxDoc()
byte[]
norms(String field)
void
norms(String field, byte[] result, int offset)
int
numDocs()
TermDocs
termDocs()
TermPositions
termPositions()
TermEnum
terms()
TermEnum
terms(Term term)

Methods inherited from class org.apache.lucene.index.IndexReader

close, commit, delete, delete, directory, doClose, doCommit, doDelete, doSetNorm, doUndeleteAll, docFreq, document, finalize, getCurrentVersion, getCurrentVersion, getCurrentVersion, getFieldNames, getFieldNames, getIndexedFieldNames, getTermFreqVector, getTermFreqVectors, hasDeletions, indexExists, indexExists, indexExists, isDeleted, isLocked, isLocked, lastModified, lastModified, lastModified, maxDoc, norms, norms, numDocs, open, open, open, setNorm, setNorm, termDocs, termDocs, termPositions, termPositions, terms, terms, undeleteAll, unlock

Constructor Details

MultiReader

public MultiReader(IndexReader[] subReaders)
            throws IOException
Construct a MultiReader aggregating the named set of (sub)readers. Directory locking for delete, undeleteAll, and setNorm operations is left to the subreaders.

Note that all subreaders are closed if this Multireader is closed.

Parameters:
subReaders - set of (sub)readers

Method Details

doClose

protected void doClose()
            throws IOException
Overrides:
doClose in interface IndexReader

doCommit

protected void doCommit()
            throws IOException
Overrides:
doCommit in interface IndexReader

doDelete

protected void doDelete(int n)
            throws IOException
Overrides:
doDelete in interface IndexReader

doSetNorm

protected void doSetNorm(int n,
                         String field,
                         byte value)
            throws IOException
Overrides:
doSetNorm in interface IndexReader

doUndeleteAll

protected void doUndeleteAll()
            throws IOException
Overrides:
doUndeleteAll in interface IndexReader

docFreq

public int docFreq(Term t)
            throws IOException
Overrides:
docFreq in interface IndexReader

document

public Document document(int n)
            throws IOException
Overrides:
document in interface IndexReader

getFieldNames

public Collection getFieldNames()
            throws IOException
Overrides:
getFieldNames in interface IndexReader

getFieldNames

public Collection getFieldNames(boolean indexed)
            throws IOException
Overrides:
getFieldNames in interface IndexReader

getIndexedFieldNames

public Collection getIndexedFieldNames(boolean storedTermVector)
Overrides:
getIndexedFieldNames in interface IndexReader

getTermFreqVector

public TermFreqVector getTermFreqVector(int n,
                                        String field)
            throws IOException
Overrides:
getTermFreqVector in interface IndexReader

getTermFreqVectors

public TermFreqVector[] getTermFreqVectors(int n)
            throws IOException
Return an array of term frequency vectors for the specified document. The array contains a vector for each vectorized field in the document. Each vector vector contains term numbers and frequencies for all terms in a given vectorized field. If no such fields existed, the method returns null.
Overrides:
getTermFreqVectors in interface IndexReader

hasDeletions

public boolean hasDeletions()
Overrides:
hasDeletions in interface IndexReader

isDeleted

public boolean isDeleted(int n)
Overrides:
isDeleted in interface IndexReader

maxDoc

public int maxDoc()
Overrides:
maxDoc in interface IndexReader

norms

public byte[] norms(String field)
            throws IOException
Overrides:
norms in interface IndexReader

norms

public void norms(String field,
                  byte[] result,
                  int offset)
            throws IOException
Overrides:
norms in interface IndexReader

numDocs

public int numDocs()
Overrides:
numDocs in interface IndexReader

termDocs

public TermDocs termDocs()
            throws IOException
Overrides:
termDocs in interface IndexReader

termPositions

public TermPositions termPositions()
            throws IOException
Overrides:
termPositions in interface IndexReader

terms

public TermEnum terms()
            throws IOException
Overrides:
terms in interface IndexReader

terms

public TermEnum terms(Term term)
            throws IOException
Overrides:
terms in interface IndexReader

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