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


Loading...
Searching...
No Matches
FilterIndexReader.h
Go to the documentation of this file.
1
2// 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
14namespace Lucene {
15
21class LPPAPI FilterIndexReader : public IndexReader {
22public:
29
31
33
34protected:
36
37public:
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);
55 virtual TermDocsPtr termDocs(const TermPtr& term);
58 virtual int64_t getVersion();
59 virtual bool isCurrent();
60 virtual bool isOptimized();
62
66
70
71protected:
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
80class LPPAPI FilterTermDocs : public TermPositions, public LuceneObject {
81public:
83 virtual ~FilterTermDocs();
84
86
87protected:
89
90public:
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
102class LPPAPI FilterTermPositions : public FilterTermDocs {
103public:
106
108
109public:
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
117class LPPAPI FilterTermEnum : public TermEnum {
118public:
121
123
124protected:
126
127public:
128 virtual bool next();
129 virtual TermPtr term();
130 virtual int32_t docFreq();
131 virtual void close();
132};
133
134}
135
136#endif
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
A FilterIndexReader contains another IndexReader, which it uses as its basic source of data,...
Definition FilterIndexReader.h:21
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...
virtual int32_t numDocs()
Returns the number of documents in this index.
virtual void doSetNorm(int32_t doc, const String &field, uint8_t value)
Implements setNorm in subclass.
virtual void doUndeleteAll()
Implements actual undeleteAll() in subclass.
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...
virtual LuceneObjectPtr getDeletesCacheKey()
If the subclass of FilteredIndexReader modifies the deleted docs, you must override this method to pr...
virtual DirectoryPtr directory()
Returns the directory associated with this index. The default implementation returns the directory sp...
virtual TermDocsPtr termDocs(const TermPtr &term)
Returns an enumeration of all the documents which contain term. For each document,...
virtual TermDocsPtr termDocs()
Returns an unpositioned TermDocs enumerator.
virtual void doCommit(MapStringString commitUserData)
Implements commit.
virtual Collection< IndexReaderPtr > getSequentialSubReaders()
Returns the sequential sub readers that this reader is logically composed of. For example,...
IndexReaderPtr in
Definition FilterIndexReader.h:35
virtual TermPositionsPtr termPositions()
Returns an unpositioned TermPositions enumerator.
FilterIndexReader(const IndexReaderPtr &in)
Construct a FilterIndexReader based on the specified base reader. Directory locking for delete,...
virtual TermEnumPtr terms()
Returns an enumeration of all the terms in the index. The enumeration is ordered by Term::compareTo()...
virtual ByteArray norms(const String &field)
Returns the byte-encoded normalization factor for the named field of every document....
virtual bool isOptimized()
Checks is the index is optimized (if it has a single segment and no deletions). Not implemented in th...
virtual bool hasDeletions()
Returns true if any documents have been deleted.
virtual LuceneObjectPtr getFieldCacheKey()
If the subclass of FilteredIndexReader modifies the contents of the FieldCache, you must override thi...
virtual void doClose()
Implements close.
virtual bool isDeleted(int32_t n)
Returns true if document n has been deleted.
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 ...
virtual void doDelete(int32_t docNum)
Implements deletion of the document numbered docNum. Applications should call deleteDocument(int) or ...
virtual Collection< TermFreqVectorPtr > getTermFreqVectors(int32_t docNumber)
Return an array of term frequency vectors for the specified document. The array contains a vector for...
virtual bool isCurrent()
Check whether any new changes have occurred to the index since this reader was opened.
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...
virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr &mapper)
Map all the term vectors for all fields in a Document.
virtual void norms(const String &field, ByteArray norms, int32_t offset)
Reads the byte-encoded normalization factor for the named field of every document....
virtual bool hasNorms(const String &field)
Returns true if there are norms stored for this field.
virtual int32_t maxDoc()
Returns one greater than the largest possible document number. This may be used to,...
virtual int32_t docFreq(const TermPtr &t)
Returns the number of documents containing the term t.
virtual TermEnumPtr terms(const TermPtr &t)
Returns an enumeration of all terms starting at a given term. If the given term does not exist,...
virtual int64_t getVersion()
Version number when this IndexReader was opened. Not implemented in the IndexReader base class.
Base class for filtering TermDocs implementations.
Definition FilterIndexReader.h:80
TermDocsPtr in
Definition FilterIndexReader.h:88
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...
virtual int32_t doc()
Returns the current document number. This is invalid until next() is called for the first time.
virtual bool next()
Moves to the next pair in the enumeration. Returns true if there is such a next pair in the enumerati...
virtual void close()
Frees associated resources.
virtual bool skipTo(int32_t target)
Skips entries to the first beyond the current whose document number is greater than or equal to targe...
virtual int32_t freq()
Returns the frequency of the term within the current document. This is invalid until next() is called...
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...
FilterTermDocs(const TermDocsPtr &in)
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.
Base class for filtering TermEnum implementations.
Definition FilterIndexReader.h:117
virtual bool next()
Increments the enumeration to the next element. True if one exists.
virtual int32_t docFreq()
Returns the docFreq of the current Term in the enumeration.
virtual void close()
Closes the enumeration to further activity, freeing resources.
virtual TermPtr term()
Returns the current Term in the enumeration.
FilterTermEnum(const TermEnumPtr &in)
TermEnumPtr in
Definition FilterIndexReader.h:125
Base class for filtering TermPositions implementations.
Definition FilterIndexReader.h:102
FilterTermPositions(const TermPositionsPtr &in)
virtual ByteArray getPayload(ByteArray data, int32_t offset)
Returns the payload data at the current term position. This is invalid until nextPosition() is called...
virtual int32_t getPayloadLength()
Returns the length of the payload at the current term position. This is invalid until nextPosition() ...
virtual bool isPayloadAvailable()
Checks if a payload can be loaded at this position. Payloads can only be loaded once per call to next...
virtual int32_t nextPosition()
Returns next position in the current document. It is an error to call this more than freq() times wit...
Utility template class to handle hash set collections that can be safely copied and shared.
Definition HashSet.h:17
IndexReader is an abstract class, providing an interface for accessing an index. Search of an index i...
Definition IndexReader.h:39
FieldOption
Constants describing field properties, for example used for IndexReader#getFieldNames(FieldOption).
Definition IndexReader.h:48
Base class for all Lucene classes.
Definition LuceneObject.h:31
Abstract class for enumerating terms.
Definition TermEnum.h:18
TermPositions provides an interface for enumerating the <document, frequency, <position>*> tuples for...
Definition TermPositions.h:18
Definition AbstractAllTermDocs.h:12
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539
boost::shared_ptr< TermPositions > TermPositionsPtr
Definition LuceneTypes.h:243
boost::shared_ptr< TermDocs > TermDocsPtr
Definition LuceneTypes.h:236
boost::shared_ptr< FieldSelector > FieldSelectorPtr
Definition LuceneTypes.h:77
boost::shared_ptr< Term > TermPtr
Definition LuceneTypes.h:233
boost::shared_ptr< TermVectorMapper > TermVectorMapperPtr
Definition LuceneTypes.h:254
boost::shared_ptr< Directory > DirectoryPtr
Definition LuceneTypes.h:489
boost::shared_ptr< TermEnum > TermEnumPtr
Definition LuceneTypes.h:235
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition LuceneTypes.h:157
boost::shared_ptr< TermFreqVector > TermFreqVectorPtr
Definition LuceneTypes.h:237
boost::shared_ptr< Document > DocumentPtr
Definition LuceneTypes.h:74

clucene.sourceforge.net