Lucene++ - a full-featured, c++ search engine
API Documentation
Go to the documentation of this file.
70 FIELD_OPTION_TERMVECTOR_WITH_POSITION_OFFSET
376 virtual ByteArray
norms(
const String& field) = 0;
381 virtual void norms(
const String& field, ByteArray norms, int32_t offset) = 0;
392 virtual void setNorm(int32_t doc,
const String& field, uint8_t value);
398 virtual void setNorm(int32_t doc,
const String& field,
double value);
459 void flush(MapStringString commitUserData);
464 void commit(MapStringString commitUserData);
527 virtual void doSetNorm(int32_t doc,
const String& field, uint8_t value) = 0;
546 virtual void doCommit(MapStringString commitUserData) = 0;
virtual int32_t docFreq(const TermPtr &t)=0
Returns the number of documents containing the term t.
virtual void getTermFreqVector(int32_t docNumber, const String &field, const TermVectorMapperPtr &mapper)=0
Load the Term Vector into a user-defined data structure instead of relying on the parallel arrays of ...
void incRef()
Increments the refCount of this IndexReader instance. RefCounts are used to determine when a reader c...
static const int32_t DEFAULT_TERMS_INDEX_DIVISOR
Definition: IndexReader.h:73
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
virtual bool hasNorms(const String &field)
Returns true if there are norms stored for this field.
virtual TermFreqVectorPtr getTermFreqVector(int32_t docNumber, const String &field)=0
Return a term frequency vector for the specified document and field. The returned vector contains ter...
virtual int32_t getTermInfosIndexDivisor()
For IndexReader implementations that use TermInfosReader to read terms, this returns the current inde...
Utility template class to handle collections that can be safely copied and shared.
Definition: Collection.h:17
virtual HashSet< String > getFieldNames(FieldOption fieldOption)=0
Get a list of unique field names that exist in this index and have the specified field option informa...
virtual int32_t numDocs()=0
Returns the number of documents in this index.
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
static IndexReaderPtr open(const DirectoryPtr &directory, const IndexDeletionPolicyPtr &deletionPolicy, bool readOnly, int32_t termInfosIndexDivisor)
Returns an IndexReader reading the index in the given Directory, with a custom IndexDeletionPolicy....
virtual LuceneObjectPtr clone(bool openReadOnly, const LuceneObjectPtr &other=LuceneObjectPtr())
Clones the IndexReader and optionally changes readOnly. A readOnly reader cannot open a writable read...
virtual MapStringString getCommitUserData()
Retrieve the String userData optionally passed to IndexWriter::commit. This will return null if Index...
virtual bool isDeleted(int32_t n)=0
Returns true if document n has been deleted.
static MapStringString getCommitUserData(const DirectoryPtr &directory)
Reads commitUserData, previously passed to IndexWriter#commit(MapStringString), from current index se...
boost::shared_ptr< TermVectorMapper > TermVectorMapperPtr
Definition: LuceneTypes.h:254
@ FIELD_OPTION_INDEXED_WITH_TERMVECTOR
All fields which are indexed with termvectors enabled.
Definition: IndexReader.h:60
static IndexReaderPtr open(const IndexCommitPtr &commit, const IndexDeletionPolicyPtr &deletionPolicy, bool readOnly, int32_t termInfosIndexDivisor)
Returns an IndexReader reading the index in the given Directory, using a specific commit and with a c...
static void main(Collection< String > args)
Prints the filename and size of each file within a given compound file. Add the -extract flag to extr...
virtual void doUndeleteAll()=0
Implements actual undeleteAll() in subclass.
virtual int64_t getVersion()
Version number when this IndexReader was opened. Not implemented in the IndexReader base class.
virtual void setNorm(int32_t doc, const String &field, uint8_t value)
Resets the normalization factor for the named field of the named document. The norm represents the pr...
virtual bool hasDeletions()=0
Returns true if any documents have been deleted.
int32_t numDeletedDocs()
Returns the number of deleted documents.
virtual bool isOptimized()
Checks is the index is optimized (if it has a single segment and no deletions). Not implemented in th...
virtual IndexReaderPtr reopen()
Refreshes an IndexReader if the index has changed since this instance was (re)opened.
virtual ByteArray norms(const String &field)=0
Returns the byte-encoded normalization factor for the named field of every document....
virtual void doClose()=0
Implements close.
@ FIELD_OPTION_ALL
All fields.
Definition: IndexReader.h:50
static IndexReaderPtr open(const DirectoryPtr &directory, bool readOnly)
Returns an IndexReader reading the index in the given Directory. You should pass readOnly = true,...
static IndexReaderPtr open(const DirectoryPtr &directory, const IndexDeletionPolicyPtr &deletionPolicy, const IndexCommitPtr &commit, bool readOnly, int32_t termInfosIndexDivisor)
virtual TermEnumPtr terms(const TermPtr &t)=0
Returns an enumeration of all terms starting at a given term. If the given term does not exist,...
virtual void acquireWriteLock()
Does nothing by default. Subclasses that require a write lock for index modifications must implement ...
virtual void deleteDocument(int32_t docNum)
Deletes the document numbered docNum. Once a document is deleted it will not appear in TermDocs or Te...
virtual TermEnumPtr terms()=0
Returns an enumeration of all the terms in the index. The enumeration is ordered by Term::compareTo()...
boost::shared_ptr< Document > DocumentPtr
Definition: LuceneTypes.h:74
Definition: AbstractAllTermDocs.h:12
An IndexReader which reads multiple, parallel indexes. Each index added must have the same number of ...
Definition: ParallelReader.h:26
An IndexReader which reads indexes with multiple segments.
Definition: DirectoryReader.h:19
Base class for all Lucene classes.
Definition: LuceneObject.h:31
@ FIELD_OPTION_UNINDEXED
All fields which are not indexed.
Definition: IndexReader.h:58
@ FIELD_OPTION_INDEXED_NO_TERMVECTOR
All fields which are indexed but don't have termvectors enabled.
Definition: IndexReader.h:62
boost::shared_ptr< TermEnum > TermEnumPtr
Definition: LuceneTypes.h:235
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
void close()
Closes files associated with this index. Also saves any new deletions to disk. No other methods shoul...
boost::shared_ptr< TermDocs > TermDocsPtr
Definition: LuceneTypes.h:236
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Efficiently clones the IndexReader (sharing most internal state).
virtual int32_t deleteDocuments(const TermPtr &term)
Deletes all documents that have a given term indexed. This is useful if one uses a document field to ...
@ FIELD_OPTION_TERMVECTOR_WITH_OFFSET
All fields with termvectors with offset values enabled.
Definition: IndexReader.h:68
virtual IndexReaderPtr reopen(bool openReadOnly)
Just like reopen(), except you can change the readOnly of the original reader. If the index is unchan...
virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr &mapper)=0
Map all the term vectors for all fields in a Document.
virtual LuceneObjectPtr getFieldCacheKey()
virtual void undeleteAll()
Undeletes all documents currently marked as deleted in this index.
IndexReader is an abstract class, providing an interface for accessing an index. Search of an index i...
Definition: IndexReader.h:39
boost::shared_ptr< TermFreqVector > TermFreqVectorPtr
Definition: LuceneTypes.h:237
@ FIELD_OPTION_OMIT_TERM_FREQ_AND_POSITIONS
All fields that omit tf.
Definition: IndexReader.h:56
@ FIELD_OPTION_STORES_PAYLOADS
All fields that store payloads.
Definition: IndexReader.h:54
FieldOption
Constants describing field properties, for example used for IndexReader#getFieldNames(FieldOption).
Definition: IndexReader.h:48
virtual int32_t maxDoc()=0
Returns one greater than the largest possible document number. This may be used to,...
virtual TermDocsPtr termDocs()=0
Returns an unpositioned TermDocs enumerator.
int32_t getRefCount()
Returns the current refCount for this reader.
virtual TermDocsPtr termDocs(const TermPtr &term)
Returns an enumeration of all the documents which contain term. For each document,...
static int64_t lastModified(const DirectoryPtr &directory2)
Returns the time the index in the named directory was last modified. Do not use this to check whether...
boost::shared_ptr< TermPositions > TermPositionsPtr
Definition: LuceneTypes.h:243
static bool indexExists(const DirectoryPtr &directory)
Returns true if an index exists at the specified directory. If the directory does not exist or if the...
@ FIELD_OPTION_TERMVECTOR_WITH_POSITION
All fields with termvectors with position values enabled.
Definition: IndexReader.h:66
virtual Collection< TermFreqVectorPtr > getTermFreqVectors(int32_t docNumber)=0
Return an array of term frequency vectors for the specified document. The array contains a vector for...
boost::shared_ptr< IndexDeletionPolicy > IndexDeletionPolicyPtr
Definition: LuceneTypes.h:153
static IndexReaderPtr open(const IndexCommitPtr &commit, bool readOnly)
Returns an IndexReader reading the index in the given IndexCommit. You should pass readOnly = true,...
virtual IndexReaderPtr reopen(const IndexCommitPtr &commit)
Reopen this reader on a specific commit point. This always returns a readOnly reader....
virtual bool hasChanges()
Used for testing.
virtual LuceneObjectPtr getDeletesCacheKey()
This returns null if the reader has no deletions.
virtual void doDelete(int32_t docNum)=0
Implements deletion of the document numbered docNum. Applications should call deleteDocument(int) or ...
static int64_t getCurrentVersion(const DirectoryPtr &directory)
Reads version number from segments files. The version number is initialized with a timestamp and then...
static IndexReaderPtr open(const IndexCommitPtr &commit, const IndexDeletionPolicyPtr &deletionPolicy, bool readOnly)
Returns an IndexReader reading the index in the given Directory, using a specific commit and with a c...
void commit(MapStringString commitUserData)
Commit changes resulting from delete, undeleteAll, or setNorm operations. If an exception is hit,...
virtual IndexCommitPtr getIndexCommit()
Return the IndexCommit that this reader has opened. This method is only implemented by those readers ...
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
@ FIELD_OPTION_TERMVECTOR
All fields with termvectors enabled. Please note that only standard termvector fields are returned.
Definition: IndexReader.h:64
virtual void setNorm(int32_t doc, const String &field, double value)
Resets the normalization factor for the named field of the named document.
virtual DirectoryPtr directory()
Returns the directory associated with this index. The default implementation returns the directory sp...
static IndexReaderPtr open(const DirectoryPtr &directory, const IndexDeletionPolicyPtr &deletionPolicy, bool readOnly)
Returns an IndexReader reading the index in the given Directory, with a custom IndexDeletionPolicy....
virtual void norms(const String &field, ByteArray norms, int32_t offset)=0
Reads the byte-encoded normalization factor for the named field of every document....
virtual Collection< IndexReaderPtr > getSequentialSubReaders()
Returns the sequential sub readers that this reader is logically composed of. For example,...
virtual int64_t getUniqueTermCount()
Returns the number of unique terms (across all fields) in this reader.
bool _hasChanges
Definition: IndexReader.h:77
boost::shared_ptr< FieldSelector > FieldSelectorPtr
Definition: LuceneTypes.h:77
bool closed
Definition: IndexReader.h:76
void flush(MapStringString commitUserData)
void commit()
Commit changes resulting from delete, undeleteAll, or setNorm operations. If an exception is hit,...
void decRef()
Decreases the refCount of this IndexReader instance. If the refCount drops to 0, then pending changes...
int32_t refCount
Definition: IndexReader.h:78
virtual void doSetNorm(int32_t doc, const String &field, uint8_t value)=0
Implements setNorm in subclass.
static IndexReaderPtr open(const DirectoryPtr &directory)
Returns a IndexReader reading the index in the given Directory, with readOnly = true.
static Collection< IndexCommitPtr > listCommits(const DirectoryPtr &dir)
Returns all commit points that exist in the Directory. Normally, because the default is {},...
virtual void doCommit(MapStringString commitUserData)=0
Implements commit.
virtual bool isCurrent()
Check whether any new changes have occurred to the index since this reader was opened.
boost::shared_ptr< IndexCommit > IndexCommitPtr
Definition: LuceneTypes.h:152
@ FIELD_OPTION_INDEXED
All indexed fields.
Definition: IndexReader.h:52
clucene.sourceforge.net