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.

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader

IndexReader.FieldOption

Constructor Summary

ParallelReader()
Construct a ParallelReader.

Method Summary

void
add(IndexReader reader)
Add an IndexReader.
void
add(IndexReader reader, boolean ignoreStoredFields)
Add an IndexReader whose stored fields will not be returned.
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 term)
Document
document(int n)
Collection
getFieldNames()
Collection
getFieldNames(boolean indexed)
Collection
getFieldNames(IndexReader.FieldOption fieldNames)
Collection
getIndexedFieldNames(Field.TermVector tvSpec)
TermFreqVector
getTermFreqVector(int n, String field)
TermFreqVector[]
getTermFreqVectors(int n)
boolean
hasDeletions()
boolean
hasNorms(String field)
boolean
isDeleted(int n)
int
maxDoc()
byte[]
norms(String field)
void
norms(String field, byte[] result, int offset)
int
numDocs()
TermDocs
termDocs()
TermDocs
termDocs(Term term)
TermPositions
termPositions()
TermPositions
termPositions(Term term)
TermEnum
terms()
TermEnum
terms(Term term)

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

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

Constructor Details

ParallelReader

public ParallelReader()
            throws IOException
Construct a ParallelReader.

Method Details

add

public void add(IndexReader reader)
            throws IOException
Add an IndexReader.

add

public void add(IndexReader reader,
                boolean ignoreStoredFields)
            throws IOException
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.

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 term)
            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

getFieldNames

public Collection getFieldNames(IndexReader.FieldOption fieldNames)
Overrides:
getFieldNames in interface IndexReader

getIndexedFieldNames

public Collection getIndexedFieldNames(Field.TermVector tvSpec)
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
Overrides:
getTermFreqVectors in interface IndexReader

hasDeletions

public boolean hasDeletions()
Overrides:
hasDeletions in interface IndexReader

hasNorms

public boolean hasNorms(String field)
            throws IOException
Overrides:
hasNorms 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

termDocs

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

termPositions

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

termPositions

public TermPositions termPositions(Term term)
            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-2006 Apache Software Foundation. All Rights Reserved.