org.apache.lucene.index

Class ParallelReader

public class ParallelReader extends IndexReader

An IndexReader which reads multiple, parallel indexes. Each index added must have the same number of documents, but typically each contains different fields. Each document contains the union of the fields of all documents with the same document number. When searching, matches for a query term are from the first index added that has the field.

This is useful, e.g., with collections that have large fields which change rarely and small fields that change more frequently. The smaller fields may be re-indexed in a new index and both indexes may be searched together.

Warning: It is up to you to make sure all indexes are created and modified the same way. For example, if you add documents to one index, you need to add the same documents in the same order to the other indexes. Failure to do so will result in undefined behavior.

Constructor Summary
ParallelReader()
Construct a ParallelReader.
Method Summary
voidadd(IndexReader reader)
Add an IndexReader.
voidadd(IndexReader reader, boolean ignoreStoredFields)
Add an IndexReader whose stored fields will not be returned.
intdocFreq(Term term)
Documentdocument(int n, FieldSelector fieldSelector)
protected voiddoClose()
protected voiddoCommit()
protected voiddoDelete(int n)
protected voiddoSetNorm(int n, String field, byte value)
protected voiddoUndeleteAll()
CollectiongetFieldNames(IndexReader.FieldOption fieldNames)
TermFreqVectorgetTermFreqVector(int n, String field)
TermFreqVector[]getTermFreqVectors(int n)
booleanhasDeletions()
booleanhasNorms(String field)
booleanisDeleted(int n)
intmaxDoc()
byte[]norms(String field)
voidnorms(String field, byte[] result, int offset)
intnumDocs()
TermDocstermDocs(Term term)
TermDocstermDocs()
TermPositionstermPositions(Term term)
TermPositionstermPositions()
TermEnumterms()
TermEnumterms(Term term)

Constructor Detail

ParallelReader

public ParallelReader()
Construct a ParallelReader.

Method Detail

add

public void add(IndexReader reader)
Add an IndexReader.

Throws: IOException if there is a low-level IO error

add

public void add(IndexReader reader, boolean ignoreStoredFields)
Add an IndexReader whose stored fields will not be returned. This can accellerate search when stored fields are only needed from a subset of the IndexReaders.

Throws: IllegalArgumentException if not all indexes contain the same number of documents IllegalArgumentException if not all indexes have the same value of maxDoc IOException if there is a low-level IO error

docFreq

public int docFreq(Term term)

document

public Document document(int n, FieldSelector fieldSelector)

doClose

protected void doClose()

doCommit

protected void doCommit()

doDelete

protected void doDelete(int n)

doSetNorm

protected void doSetNorm(int n, String field, byte value)

doUndeleteAll

protected void doUndeleteAll()

getFieldNames

public Collection getFieldNames(IndexReader.FieldOption fieldNames)

getTermFreqVector

public TermFreqVector getTermFreqVector(int n, String field)

getTermFreqVectors

public TermFreqVector[] getTermFreqVectors(int n)

hasDeletions

public boolean hasDeletions()

hasNorms

public boolean hasNorms(String field)

isDeleted

public boolean isDeleted(int n)

maxDoc

public int maxDoc()

norms

public byte[] norms(String field)

norms

public void norms(String field, byte[] result, int offset)

numDocs

public int numDocs()

termDocs

public TermDocs termDocs(Term term)

termDocs

public TermDocs termDocs()

termPositions

public TermPositions termPositions(Term term)

termPositions

public TermPositions termPositions()

terms

public TermEnum terms()

terms

public TermEnum terms(Term term)
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.