org.apache.lucene.index

Class FilterIndexReader


public class FilterIndexReader
extends IndexReader

A FilterIndexReader contains another IndexReader, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. The class FilterIndexReader itself simply implements all abstract methods of IndexReader with versions that pass all requests to the contained index reader. Subclasses of FilterIndexReader may further override some of these methods and may also provide additional methods and fields.

Nested Class Summary

static class
FilterIndexReader.FilterTermDocs
Base class for filtering TermDocs implementations.
static class
FilterIndexReader.FilterTermEnum
Base class for filtering TermEnum implementations.
static class
FilterIndexReader.FilterTermPositions
Base class for filtering TermPositions implementations.

Field Summary

protected IndexReader
in

Constructor Summary

FilterIndexReader(IndexReader in)
Construct a FilterIndexReader based on the specified base reader.

Method Summary

protected void
doClose()
protected void
doCommit()
protected void
doDelete(int n)
protected void
doSetNorm(int d, String f, byte b)
protected void
doUndeleteAll()
int
docFreq(Term t)
Document
document(int n)
Collection
getFieldNames()
Collection
getFieldNames(boolean indexed)
Collection
getIndexedFieldNames(boolean storedTermVector)
TermFreqVector
getTermFreqVector(int docNumber, String field)
TermFreqVector[]
getTermFreqVectors(int docNumber)
boolean
hasDeletions()
boolean
isDeleted(int n)
int
maxDoc()
byte[]
norms(String f)
void
norms(String f, byte[] bytes, int offset)
int
numDocs()
TermDocs
termDocs()
TermPositions
termPositions()
TermEnum
terms()
TermEnum
terms(Term t)

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

Field Details

in

protected IndexReader in

Constructor Details

FilterIndexReader

public FilterIndexReader(IndexReader in)
Construct a FilterIndexReader based on the specified base reader. Directory locking for delete, undeleteAll, and setNorm operations is left to the base reader.

Note that base reader is closed if this FilterIndexReader is closed.

Parameters:
in - specified base reader.

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 d,
                         String f,
                         byte b)
            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
Parameters:
storedTermVector - if true, returns only Indexed fields that have term vector info, else only indexed fields without term vector info
Returns:
Collection of Strings indicating the names of the fields

getTermFreqVector

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

getTermFreqVectors

public TermFreqVector[] getTermFreqVectors(int docNumber)
            throws IOException
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 f)
            throws IOException
Overrides:
norms in interface IndexReader

norms

public void norms(String f,
                  byte[] bytes,
                  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 t)
            throws IOException
Overrides:
terms in interface IndexReader

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