Lucene++ - a full-featured, c++ search engine
API Documentation

FilterIndexReader.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef FILTERINDEXREADER_H
8 #define FILTERINDEXREADER_H
9
10 #include "IndexReader.h"
11 #include "TermPositions.h"
12 #include "TermEnum.h"
13
14 namespace Lucene {
15
21 class LPPAPI FilterIndexReader : public IndexReader {
22 public:
28 FilterIndexReader(const IndexReaderPtr& in);
29
30 virtual ~FilterIndexReader();
31
32 LUCENE_CLASS(FilterIndexReader);
33
34 protected:
35 IndexReaderPtr in;
36
37 public:
38 virtual DirectoryPtr directory();
39 virtual Collection<TermFreqVectorPtr> getTermFreqVectors(int32_t docNumber);
40 virtual TermFreqVectorPtr getTermFreqVector(int32_t docNumber, const String& field);
41 virtual void getTermFreqVector(int32_t docNumber, const String& field, const TermVectorMapperPtr& mapper);
42 virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr& mapper);
43 virtual int32_t numDocs();
44 virtual int32_t maxDoc();
45 virtual DocumentPtr document(int32_t n, const FieldSelectorPtr& fieldSelector);
46 virtual bool isDeleted(int32_t n);
47 virtual bool hasDeletions();
48 virtual bool hasNorms(const String& field);
49 virtual ByteArray norms(const String& field);
50 virtual void norms(const String& field, ByteArray norms, int32_t offset);
51 virtual TermEnumPtr terms();
52 virtual TermEnumPtr terms(const TermPtr& t);
53 virtual int32_t docFreq(const TermPtr& t);
54 virtual TermDocsPtr termDocs();
55 virtual TermDocsPtr termDocs(const TermPtr& term);
56 virtual TermPositionsPtr termPositions();
57 virtual HashSet<String> getFieldNames(FieldOption fieldOption);
58 virtual int64_t getVersion();
59 virtual bool isCurrent();
60 virtual bool isOptimized();
61 virtual Collection<IndexReaderPtr> getSequentialSubReaders();
62
65 virtual LuceneObjectPtr getFieldCacheKey();
66
69 virtual LuceneObjectPtr getDeletesCacheKey();
70
71 protected:
72 virtual void doUndeleteAll();
73 virtual void doSetNorm(int32_t doc, const String& field, uint8_t value);
74 virtual void doDelete(int32_t docNum);
75 virtual void doCommit(MapStringString commitUserData);
76 virtual void doClose();
77 };
78
80 class LPPAPI FilterTermDocs : public TermPositions, public LuceneObject {
81 public:
82 FilterTermDocs(const TermDocsPtr& in);
83 virtual ~FilterTermDocs();
84
85 LUCENE_CLASS(FilterTermDocs);
86
87 protected:
88 TermDocsPtr in;
89
90 public:
91 virtual void seek(const TermPtr& term);
92 virtual void seek(const TermEnumPtr& termEnum);
93 virtual int32_t doc();
94 virtual int32_t freq();
95 virtual bool next();
96 virtual int32_t read(Collection<int32_t> docs, Collection<int32_t> freqs);
97 virtual bool skipTo(int32_t target);
98 virtual void close();
99 };
100
102 class LPPAPI FilterTermPositions : public FilterTermDocs {
103 public:
104 FilterTermPositions(const TermPositionsPtr& in);
105 virtual ~FilterTermPositions();
106
107 LUCENE_CLASS(FilterTermPositions);
108
109 public:
110 virtual int32_t nextPosition();
111 virtual int32_t getPayloadLength();
112 virtual ByteArray getPayload(ByteArray data, int32_t offset);
113 virtual bool isPayloadAvailable();
114 };
115
117 class LPPAPI FilterTermEnum : public TermEnum {
118 public:
119 FilterTermEnum(const TermEnumPtr& in);
120 virtual ~FilterTermEnum();
121
122 LUCENE_CLASS(FilterTermEnum);
123
124 protected:
125 TermEnumPtr in;
126
127 public:
128 virtual bool next();
129 virtual TermPtr term();
130 virtual int32_t docFreq();
131 virtual void close();
132 };
133
134 }
135
136 #endif
IndexReader.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
TermEnum.h
TermPositions.h
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition: Collection.h:17
Lucene::FilterIndexReader
A FilterIndexReader contains another IndexReader, which it uses as its basic source of data,...
Definition: FilterIndexReader.h:21
Lucene::FilterIndexReader::getTermFreqVector
virtual TermFreqVectorPtr getTermFreqVector(int32_t docNumber, const String &field)
Return a term frequency vector for the specified document and field. The returned vector contains ter...
Lucene::FilterIndexReader::numDocs
virtual int32_t numDocs()
Returns the number of documents in this index.
Lucene::FilterIndexReader::doSetNorm
virtual void doSetNorm(int32_t doc, const String &field, uint8_t value)
Implements setNorm in subclass.
Lucene::FilterIndexReader::doUndeleteAll
virtual void doUndeleteAll()
Implements actual undeleteAll() in subclass.
Lucene::FilterIndexReader::getSequentialSubReaders
virtual Collection< IndexReaderPtr > getSequentialSubReaders()
Returns the sequential sub readers that this reader is logically composed of. For example,...
Lucene::FilterIndexReader::document
virtual DocumentPtr document(int32_t n, const FieldSelectorPtr &fieldSelector)
Get the Document at the n'th position. The FieldSelector may be used to determine what Fields to load...
Lucene::FilterIndexReader::getDeletesCacheKey
virtual LuceneObjectPtr getDeletesCacheKey()
If the subclass of FilteredIndexReader modifies the deleted docs, you must override this method to pr...
Lucene::FilterIndexReader::directory
virtual DirectoryPtr directory()
Returns the directory associated with this index. The default implementation returns the directory sp...
Lucene::FilterIndexReader::termDocs
virtual TermDocsPtr termDocs(const TermPtr &term)
Returns an enumeration of all the documents which contain term. For each document,...
Lucene::FilterIndexReader::termDocs
virtual TermDocsPtr termDocs()
Returns an unpositioned TermDocs enumerator.
Lucene::FilterIndexReader::doCommit
virtual void doCommit(MapStringString commitUserData)
Implements commit.
Lucene::FilterIndexReader::in
IndexReaderPtr in
Definition: FilterIndexReader.h:32
Lucene::FilterIndexReader::~FilterIndexReader
virtual ~FilterIndexReader()
Lucene::FilterIndexReader::getTermFreqVectors
virtual Collection< TermFreqVectorPtr > getTermFreqVectors(int32_t docNumber)
Return an array of term frequency vectors for the specified document. The array contains a vector for...
Lucene::FilterIndexReader::termPositions
virtual TermPositionsPtr termPositions()
Returns an unpositioned TermPositions enumerator.
Lucene::FilterIndexReader::FilterIndexReader
FilterIndexReader(const IndexReaderPtr &in)
Construct a FilterIndexReader based on the specified base reader. Directory locking for delete,...
Lucene::FilterIndexReader::terms
virtual TermEnumPtr terms()
Returns an enumeration of all the terms in the index. The enumeration is ordered by Term::compareTo()...
Lucene::FilterIndexReader::norms
virtual ByteArray norms(const String &field)
Returns the byte-encoded normalization factor for the named field of every document....
Lucene::FilterIndexReader::isOptimized
virtual bool isOptimized()
Checks is the index is optimized (if it has a single segment and no deletions). Not implemented in th...
Lucene::FilterIndexReader::hasDeletions
virtual bool hasDeletions()
Returns true if any documents have been deleted.
Lucene::FilterIndexReader::getFieldCacheKey
virtual LuceneObjectPtr getFieldCacheKey()
If the subclass of FilteredIndexReader modifies the contents of the FieldCache, you must override thi...
Lucene::FilterIndexReader::doClose
virtual void doClose()
Implements close.
Lucene::FilterIndexReader::getFieldNames
virtual HashSet< String > getFieldNames(FieldOption fieldOption)
Get a list of unique field names that exist in this index and have the specified field option informa...
Lucene::FilterIndexReader::isDeleted
virtual bool isDeleted(int32_t n)
Returns true if document n has been deleted.
Lucene::FilterIndexReader::getTermFreqVector
virtual void getTermFreqVector(int32_t docNumber, const String &field, const TermVectorMapperPtr &mapper)
Load the Term Vector into a user-defined data structure instead of relying on the parallel arrays of ...
Lucene::FilterIndexReader::doDelete
virtual void doDelete(int32_t docNum)
Implements deletion of the document numbered docNum. Applications should call deleteDocument(int) or ...
Lucene::FilterIndexReader::isCurrent
virtual bool isCurrent()
Check whether any new changes have occurred to the index since this reader was opened.
Lucene::FilterIndexReader::getTermFreqVector
virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr &mapper)
Map all the term vectors for all fields in a Document.
Lucene::FilterIndexReader::norms
virtual void norms(const String &field, ByteArray norms, int32_t offset)
Reads the byte-encoded normalization factor for the named field of every document....
Lucene::FilterIndexReader::hasNorms
virtual bool hasNorms(const String &field)
Returns true if there are norms stored for this field.
Lucene::FilterIndexReader::maxDoc
virtual int32_t maxDoc()
Returns one greater than the largest possible document number. This may be used to,...
Lucene::FilterIndexReader::docFreq
virtual int32_t docFreq(const TermPtr &t)
Returns the number of documents containing the term t.
Lucene::FilterIndexReader::terms
virtual TermEnumPtr terms(const TermPtr &t)
Returns an enumeration of all terms starting at a given term. If the given term does not exist,...
Lucene::FilterIndexReader::getVersion
virtual int64_t getVersion()
Version number when this IndexReader was opened. Not implemented in the IndexReader base class.
Lucene::FilterTermDocs
Base class for filtering TermDocs implementations.
Definition: FilterIndexReader.h:80
Lucene::FilterTermDocs::in
TermDocsPtr in
Definition: FilterIndexReader.h:85
Lucene::FilterTermDocs::seek
virtual void seek(const TermEnumPtr &termEnum)
Sets this to the data for the current term in a TermEnum. This may be optimized in some implementatio...
Lucene::FilterTermDocs::doc
virtual int32_t doc()
Returns the current document number. This is invalid until next() is called for the first time.
Lucene::FilterTermDocs::next
virtual bool next()
Moves to the next pair in the enumeration. Returns true if there is such a next pair in the enumerati...
Lucene::FilterTermDocs::close
virtual void close()
Frees associated resources.
Lucene::FilterTermDocs::~FilterTermDocs
virtual ~FilterTermDocs()
Lucene::FilterTermDocs::skipTo
virtual bool skipTo(int32_t target)
Skips entries to the first beyond the current whose document number is greater than or equal to targe...
Lucene::FilterTermDocs::freq
virtual int32_t freq()
Returns the frequency of the term within the current document. This is invalid until next() is called...
Lucene::FilterTermDocs::FilterTermDocs
FilterTermDocs(const TermDocsPtr &in)
Lucene::FilterTermDocs::seek
virtual void seek(const TermPtr &term)
Sets this to the data for a term. The enumeration is reset to the start of the data for this term.
Lucene::FilterTermDocs::read
virtual int32_t read(Collection< int32_t > docs, Collection< int32_t > freqs)
Attempts to read multiple entries from the enumeration, up to length of docs. Document numbers are st...
Lucene::FilterTermEnum
Base class for filtering TermEnum implementations.
Definition: FilterIndexReader.h:117
Lucene::FilterTermEnum::next
virtual bool next()
Increments the enumeration to the next element. True if one exists.
Lucene::FilterTermEnum::docFreq
virtual int32_t docFreq()
Returns the docFreq of the current Term in the enumeration.
Lucene::FilterTermEnum::close
virtual void close()
Closes the enumeration to further activity, freeing resources.
Lucene::FilterTermEnum::term
virtual TermPtr term()
Returns the current Term in the enumeration.
Lucene::FilterTermEnum::~FilterTermEnum
virtual ~FilterTermEnum()
Lucene::FilterTermEnum::FilterTermEnum
FilterTermEnum(const TermEnumPtr &in)
Lucene::FilterTermEnum::in
TermEnumPtr in
Definition: FilterIndexReader.h:122
Lucene::FilterTermPositions
Base class for filtering TermPositions implementations.
Definition: FilterIndexReader.h:102
Lucene::FilterTermPositions::~FilterTermPositions
virtual ~FilterTermPositions()
Lucene::FilterTermPositions::FilterTermPositions
FilterTermPositions(const TermPositionsPtr &in)
Lucene::FilterTermPositions::getPayload
virtual ByteArray getPayload(ByteArray data, int32_t offset)
Returns the payload data at the current term position. This is invalid until nextPosition() is called...
Lucene::FilterTermPositions::getPayloadLength
virtual int32_t getPayloadLength()
Returns the length of the payload at the current term position. This is invalid until {} is called fo...
Lucene::FilterTermPositions::isPayloadAvailable
virtual bool isPayloadAvailable()
Checks if a payload can be loaded at this position. Payloads can only be loaded once per call to next...
Lucene::FilterTermPositions::nextPosition
virtual int32_t nextPosition()
Returns next position in the current document. It is an error to call this more than freq() times wit...
Lucene::HashSet< String >
Lucene::IndexReader
IndexReader is an abstract class, providing an interface for accessing an index. Search of an index i...
Definition: IndexReader.h:39
Lucene::IndexReader::FieldOption
FieldOption
Constants describing field properties, for example used for IndexReader#getFieldNames(FieldOption).
Definition: IndexReader.h:48
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene::TermEnum
Abstract class for enumerating terms.
Definition: TermEnum.h:18
Lucene::TermPositions
TermPositions provides an interface for enumerating the <document, frequency, <position>*> tuples for...
Definition: TermPositions.h:18
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Lucene::TermPositionsPtr
boost::shared_ptr< TermPositions > TermPositionsPtr
Definition: LuceneTypes.h:243
Lucene::TermDocsPtr
boost::shared_ptr< TermDocs > TermDocsPtr
Definition: LuceneTypes.h:236
Lucene::FieldSelectorPtr
boost::shared_ptr< FieldSelector > FieldSelectorPtr
Definition: LuceneTypes.h:77
Lucene::TermPtr
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
Lucene::TermVectorMapperPtr
boost::shared_ptr< TermVectorMapper > TermVectorMapperPtr
Definition: LuceneTypes.h:254
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Lucene::TermEnumPtr
boost::shared_ptr< TermEnum > TermEnumPtr
Definition: LuceneTypes.h:235
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
Lucene::TermFreqVectorPtr
boost::shared_ptr< TermFreqVector > TermFreqVectorPtr
Definition: LuceneTypes.h:237
Lucene::DocumentPtr
boost::shared_ptr< Document > DocumentPtr
Definition: LuceneTypes.h:74

clucene.sourceforge.net