Lucene.Net
3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
|
Inherits Lucene.Net.Index.SegmentReader.
Public Member Functions | |
override bool | IsDeleted (int n) |
Returns true if document n has been deleted | |
Public Member Functions inherited from Lucene.Net.Index.SegmentReader | |
SegmentReader () | |
override System.Object | Clone () |
Efficiently clones the IndexReader (sharing most internal state). On cloning a reader with pending changes (deletions, norms), the original reader transfers its write lock to the cloned reader. This means only the cloned reader may make further changes to the index, and commit the changes to the index on close, but the old reader still reflects all changes made up until it was cloned. Like Reopen(), it's safe to make changes to either the original or the cloned reader: all shared mutable state obeys "copy on write" semantics to ensure the changes are not seen by other readers. | |
override IndexReader | Clone (bool openReadOnly) |
Clones the IndexReader and optionally changes readOnly. A readOnly reader cannot open a writeable reader. | |
override TermEnum | Terms () |
Returns an enumeration of all the terms in the index. The enumeration is ordered by Term.compareTo(). Each term is greater than all that precede it in the enumeration. Note that after calling terms(), TermEnum.Next() must be called on the resulting enumeration before calling other methods such as TermEnum.Term. | |
override TermEnum | Terms (Term t) |
Returns an enumeration of all terms starting at a given term. If the given term does not exist, the enumeration is positioned at the first term greater than the supplied term. The enumeration is ordered by Term.compareTo(). Each term is greater than all that precede it in the enumeration. | |
virtual FieldInfos | FieldInfos () |
override Document | Document (int n, FieldSelector fieldSelector) |
Get the Lucene.Net.Documents.Document at the n th position. The FieldSelector may be used to determine what Lucene.Net.Documents.Fields to load and how they should be loaded. NOTE: If this Reader (more specifically, the underlying FieldsReader ) is closed before the lazy Lucene.Net.Documents.Field is loaded an exception may be thrown. If you want the value of a lazy Lucene.Net.Documents.Field to be available after closing you must explicitly load it or fetch the Document again with a new loader. NOTE: for performance reasons, this method does not check if the requested document is deleted, and therefore asking for a deleted document may yield unspecified results. Usually this is not required, however you can call IsDeleted(int) with the requested document ID to verify the document is not deleted. | |
override bool | IsDeleted (int n) |
Returns true if document n has been deleted | |
override TermDocs | TermDocs (Term term) |
Returns an enumeration of all the documents which contain term . For each document, the document number, the frequency of the term in that document is also provided, for use in search scoring. If term is null, then all non-deleted docs are returned with freq=1. Thus, this method implements the mapping:    =>    <docNum, freq>* The enumeration is ordered by document number. Each document number is greater than all that precede it in the enumeration. | |
override TermDocs | TermDocs () |
Returns an unpositioned Lucene.Net.Index.TermDocs enumerator. | |
override TermPositions | TermPositions () |
Returns an unpositioned Lucene.Net.Index.TermPositions enumerator. | |
override int | DocFreq (Term t) |
Returns the number of documents containing the term t . | |
override int | NumDocs () |
Returns the number of documents in this index. | |
override System.Collections.Generic.ICollection < string > | GetFieldNames (IndexReader.FieldOption fieldOption) |
override bool | HasNorms (System.String field) |
Returns true if there are norms stored for this field. | |
override byte[] | Norms (System.String field) |
Returns the byte-encoded normalization factor for the named field of every document. This is used by the search code to score documents. | |
override void | Norms (System.String field, byte[] bytes, int offset) |
Read norms into a pre-allocated array. | |
virtual bool | TermsIndexLoaded () |
virtual bool | NormsClosed () |
virtual bool | NormsClosed (System.String field) |
override ITermFreqVector | GetTermFreqVector (int docNumber, System.String field) |
Return a term frequency vector for the specified document and field. The vector returned contains term numbers and frequencies for all terms in the specified field of this document, if the field had storeTermVector flag set. If the flag was not set, the method returns null. | |
override void | GetTermFreqVector (int docNumber, System.String field, TermVectorMapper mapper) |
override void | GetTermFreqVector (int docNumber, TermVectorMapper mapper) |
Map all the term vectors for all fields in a Document | |
override ITermFreqVector[] | GetTermFreqVectors (int docNumber) |
Return an array of term frequency vectors for the specified document. The array contains a vector for each vectorized field in the document. Each vector vector contains term numbers and frequencies for all terms in a given vectorized field. If no such fields existed, the method returns null. | |
override Directory | Directory () |
Returns the directory this index resides in. | |
Public Member Functions inherited from Lucene.Net.Index.IndexReader | |
virtual void | IncRef () |
Expert: increments the refCount of this IndexReader instance. RefCounts are used to determine when a reader can be closed safely, i.e. as soon as there are no more references. Be sure to always call a corresponding DecRef, in a finally clause; otherwise the reader may never be closed. Note that Close simply calls decRef(), which means that the IndexReader will not really be closed until DecRef has been called for all outstanding references. | |
virtual void | DecRef () |
Expert: decreases the refCount of this IndexReader instance. If the refCount drops to 0, then pending changes (if any) are committed to the index and this reader is closed. | |
virtual IndexReader | Reopen () |
Refreshes an IndexReader if the index has changed since this instance was (re)opened. Opening an IndexReader is an expensive operation. This method can be used to refresh an existing IndexReader to reduce these costs. This method tries to only load segments that have changed or were created after the IndexReader was (re)opened. If the index has not changed since this instance was (re)opened, then this call is a NOOP and returns this instance. Otherwise, a new instance is returned. The old instance is not closed and remains usable. If the reader is reopened, even though they share resources internally, it's safe to make changes (deletions, norms) with the new reader. All shared mutable state obeys "copy on write" semantics to ensure the changes are not seen by other readers. You can determine whether a reader was actually reopened by comparing the old instance with the instance returned by this method: | |
virtual IndexReader | Reopen (bool openReadOnly) |
Just like Reopen(), except you can change the readOnly of the original reader. If the index is unchanged but readOnly is different then a new reader will be returned. | |
virtual IndexReader | Reopen (IndexCommit commit) |
Expert: reopen this reader on a specific commit point. This always returns a readOnly reader. If the specified commit point matches what this reader is already on, and this reader is already readOnly, then this same instance is returned; if it is not already readOnly, a readOnly clone is returned. | |
virtual bool | IsCurrent () |
Check whether any new changes have occurred to the index since this reader was opened. | |
virtual bool | IsOptimized () |
Checks is the index is optimized (if it has a single segment and no deletions). Not implemented in the IndexReader base class. | |
abstract ITermFreqVector | GetTermFreqVector (int docNumber, String field) |
Return a term frequency vector for the specified document and field. The returned vector contains terms and frequencies for the terms in the specified field of this document, if the field had the storeTermVector flag set. If termvectors had been stored with positions or offsets, a TermPositionVector is returned. | |
abstract void | GetTermFreqVector (int docNumber, String field, TermVectorMapper mapper) |
Load the Term Vector into a user-defined data structure instead of relying on the parallel arrays of the ITermFreqVector. | |
virtual Document | Document (int n) |
Returns the stored fields of the n th Document in this index. NOTE: for performance reasons, this method does not check if the requested document is deleted, and therefore asking for a deleted document may yield unspecified results. Usually this is not required, however you can call IsDeleted(int) with the requested document ID to verify the document is not deleted. | |
virtual void | SetNorm (int doc, String field, byte value) |
Expert: Resets the normalization factor for the named field of the named document. The norm represents the product of the field's boost and its length normalization. Thus, to preserve the length normalization values when resetting this, one should base the new value upon the old. | |
virtual void | SetNorm (int doc, System.String field, float value) |
Expert: Resets the normalization factor for the named field of the named document. | |
virtual TermPositions | TermPositions (Term term) |
Returns an enumeration of all the documents which contain term . For each document, in addition to the document number and frequency of the term in that document, a list of all of the ordinal positions of the term in the document is available. Thus, this method implements the mapping: | |
virtual void | DeleteDocument (int docNum) |
Deletes the document numbered docNum . Once a document is deleted it will not appear in TermDocs or TermPostitions enumerations. Attempts to read its field with the Document(int) method will result in an error. The presence of this document may still be reflected in the DocFreq statistic, though this will be corrected eventually as the index is further modified. | |
virtual int | DeleteDocuments (Term term) |
Deletes all documents that have a given term indexed. This is useful if one uses a document field to hold a unique ID string for the document. Then to delete such a document, one merely constructs a term with the appropriate field and the unique ID string as its text and passes it to this method. See DeleteDocument(int) for information about when this deletion will become effective. | |
virtual void | UndeleteAll () |
Undeletes all documents currently marked as deleted in this index. | |
void | Flush () |
| |
void | Flush (IDictionary< string, string > commitUserData) |
void | Commit () |
Commit changes resulting from delete, undeleteAll, or setNorm operations | |
void | Commit (IDictionary< string, string > commitUserData) |
Commit changes resulting from delete, undeleteAll, or setNorm operations | |
void | Close () |
void | Dispose () |
Closes files associated with this index. Also saves any new deletions to disk. No other methods should be called after this has been called. | |
abstract ICollection< string > | GetFieldNames (FieldOption fldOption) |
Get a list of unique field names that exist in this index and have the specified field option information. | |
virtual IndexReader[] | GetSequentialSubReaders () |
Expert: returns the sequential sub readers that this reader is logically composed of. For example, IndexSearcher uses this API to drive searching by one sub reader at a time. If this reader is not composed of sequential child readers, it should return null. If this method returns an empty array, that means this reader is a null reader (for example a MultiReader that has no sub readers). NOTE: You should not try using sub-readers returned by this method to make any changes (setNorm, deleteDocument, etc.). While this might succeed for one composite reader (like MultiReader), it will most likely lead to index corruption for other readers (like DirectoryReader obtained through IndexReader.Open(Lucene.Net.Store.Directory,bool). Use the parent reader directly. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Lucene.Net.Index.SegmentReader | |
static SegmentReader | Get (bool readOnly, SegmentInfo si, int termInfosIndexDivisor) |
static SegmentReader | Get (bool readOnly, Directory dir, SegmentInfo si, int readBufferSize, bool doOpenStores, int termInfosIndexDivisor) |
static SegmentReader | GetOnlySegmentReader (Directory dir) |
Lotsa tests did hacks like: SegmentReader reader = (SegmentReader) IndexReader.open(dir); They broke. This method serves as a hack to keep hacks working We do it with R/W access for the tests (BW compatibility) | |
static SegmentReader | GetOnlySegmentReader (IndexReader reader) |
Protected Member Functions inherited from Lucene.Net.Index.IndexReader | |
virtual void | Dispose (bool disposing) |
Properties inherited from Lucene.Net.Index.SegmentReader | |
override bool | HasDeletions [get] |
override int | MaxDoc [get] |
virtual string | SegmentName [get] |
Return the name of the segment this reader is reading. | |
override object | FieldCacheKey [get] |
override object | DeletesCacheKey [get] |
override long | UniqueTermCount [get] |
override int | TermInfosIndexDivisor [get] |
System.Collections.Generic.IDictionary < string, Norm > | norms_ForNUnit [get] |
BitVector | deletedDocs_ForNUnit [get] |
CoreReaders | core_ForNUnit [get] |
Ref | deletedDocsRef_ForNUnit [get] |
Definition at line 23 of file ReadOnlySegmentReader.cs.
|
virtual |
Returns true if document n has been deleted
Implements Lucene.Net.Index.IndexReader.
Definition at line 37 of file ReadOnlySegmentReader.cs.