C# 클래스 Lucene.Net.Index.IndexReader

IndexReader is an abstract class, providing an interface for accessing an index. Search of an index is done entirely through this abstract interface, so that any subclass which implements it is searchable.

There are two different types of IndexReaders:

  • AtomicReader: These indexes do not consist of several sub-readers, they are atomic. They support retrieval of stored fields, doc values, terms, and postings.
  • CompositeReader: Instances (like DirectoryReader) of this reader can only be used to get stored fields from the underlying AtomicReaders, but it is not possible to directly retrieve postings. To do that, get the sub-readers via CompositeReader#getSequentialSubReaders. Alternatively, you can mimic an AtomicReader (with a serious slowdown), by wrapping composite readers with SlowCompositeReaderWrapper.

IndexReader instances for indexes on disk are usually constructed with a call to one of the static DirectoryReader.open() methods, e.g. DirectoryReader#open(Lucene.Net.Store.Directory). DirectoryReader implements the CompositeReader interface, it is not possible to directly get postings.

For efficiency, in this API documents are often referred to via document numbers, non-negative integers which each name a unique document in the index. These document numbers are ephemeral -- they may change as documents are added to and deleted from an index. Clients should thus not rely on a given document having the same number between sessions.

NOTE: {@link IndexReader} instances are completely thread safe, meaning multiple threads can call any of its methods, concurrently. If your application requires external synchronization, you should not synchronize on the IndexReader instance; use your own (non-Lucene) objects instead.

상속: IDisposable
파일 보기 프로젝트 열기: synhershko/lucene.net 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
DEFAULT_TERMS_INDEX_DIVISOR int
hasChanges bool

공개 메소드들

메소드 설명
Clone ( bool openReadOnly ) : IndexReader

Clones the IndexReader and optionally changes readOnly. A readOnly reader cannot open a writeable reader.

Clone ( ) : Object

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.

Commit ( ) : void

Commit changes resulting from delete, undeleteAll, or setNorm operations If an exception is hit, then either no changes or all changes will have been committed to the index (transactional semantics).

Commit ( string>.IDictionary commitUserData ) : void

Commit changes resulting from delete, undeleteAll, or setNorm operations If an exception is hit, then either no changes or all changes will have been committed to the index (transactional semantics).

DecRef ( ) : void

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.

DeleteDocument ( int docNum ) : void

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.

since this reader was opened

has this index open (write.lock could not be obtained)

DeleteDocuments ( Lucene.Net.Index.Term term ) : int

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.

since this reader was opened

has this index open (write.lock could not be obtained)

Directory ( ) : Directory

Returns the directory associated with this index. The Default implementation returns the directory specified by subclasses when delegating to the IndexReader(Directory) constructor, or throws an UnsupportedOperationException if one was not specified.

Dispose ( ) : void

Closes files associated with this index. Also saves any new deletions to disk. No other methods should be called after this has been called.

DocFreq ( Lucene.Net.Index.Term t ) : int

Returns the number of documents containing the term t.

Document ( int n ) : Lucene.Net.Documents.Document

Returns the stored fields of the nth 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.

Document ( int n, Lucene.Net.Documents.FieldSelector fieldSelector ) : Lucene.Net.Documents.Document

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.

Flush ( ) : void

Flush ( string>.IDictionary commitUserData ) : void
GetCommitUserData ( Directory directory ) : IDictionary,System.Collections.Generic

Reads commitUserData, previously passed to IndexWriter.Commit(System.Collections.Generic.IDictionary{string, string}), from current index segments file. This will return null if IndexWriter.Commit(System.Collections.Generic.IDictionary{string, string}) has never been called for this index.

GetCurrentVersion ( Directory directory ) : long

Reads version number from segments files. The version number is initialized with a timestamp and then increased by one for each change of the index.

GetFieldNames ( FieldOption fldOption ) : ICollection

Get a list of unique field names that exist in this index and have the specified field option information.

GetSequentialSubReaders ( ) : Lucene.Net.Index.IndexReader[]

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.

GetTermFreqVector ( int docNumber, String field ) : ITermFreqVector

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.

GetTermFreqVector ( int docNumber, String field, Lucene.Net.Index.TermVectorMapper mapper ) : void

Load the Term Vector into a user-defined data structure instead of relying on the parallel arrays of the ITermFreqVector.

GetTermFreqVector ( int docNumber, Lucene.Net.Index.TermVectorMapper mapper ) : void

Map all the term vectors for all fields in a Document

GetTermFreqVectors ( int docNumber ) : ITermFreqVector[]

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 contains terms and frequencies for all terms in a given vectorized field. If no such fields existed, the method returns null. The term vectors that are returned may either be of type ITermFreqVector or of type TermPositionVector if positions or offsets have been stored.

HasNorms ( System field ) : bool

Returns true if there are norms stored for this field.

IncRef ( ) : void

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.

IndexExists ( Directory directory ) : bool

Returns true if an index exists at the specified directory. If the directory does not exist or if there is no index in it.

IsCurrent ( ) : bool

Check whether any new changes have occurred to the index since this reader was opened.

If this reader is based on a Directory (ie, was created by calling Open(Store.Directory) , or Reopen() on a reader based on a Directory), then this method checks if any further commits (see IndexWriter.Commit() have occurred in that directory).

If instead this reader is a near real-time reader (ie, obtained by a call to IndexWriter.GetReader(), or by calling Reopen() on a near real-time reader), then this method checks if either a new commmit has occurred, or any new uncommitted changes have taken place via the writer. Note that even if the writer has only performed merging, this method will still return false.

In any event, if this returns false, you should call Reopen() to get a new reader that sees the changes.

IsDeleted ( int n ) : bool

Returns true if document n has been deleted

IsOptimized ( ) : bool

Checks is the index is optimized (if it has a single segment and no deletions). Not implemented in the IndexReader base class.

LastModified ( Directory directory2 ) : long

Returns the time the index in the named directory was last modified. Do not use this to check whether the reader is still up-to-date, use IsCurrent() instead.

ListCommits ( Directory dir ) : System.Collections.Generic.ICollection

Returns all commit points that exist in the Directory. Normally, because the default is KeepOnlyLastCommitDeletionPolicy , there would be only one commit point. But if you're using a custom IndexDeletionPolicy then there could be many commits. Once you have a given commit, you can open a reader on it by calling IndexReader.Open(IndexCommit,bool) There must be at least one commit in the Directory, else this method throws System.IO.IOException. Note that if a commit is in progress while this method is running, that commit may or may not be returned array.

Norms ( System field ) : byte[]

Returns the byte-encoded normalization factor for the named field of every document. This is used by the search code to score documents.

Norms ( System field, byte bytes, int offset ) : void

Reads the byte-encoded normalization factor for the named field of every document. This is used by the search code to score documents.

Open ( Directory directory, IndexDeletionPolicy deletionPolicy, bool readOnly ) : IndexReader

Expert: returns an IndexReader reading the index in the given Directory, with a custom IndexDeletionPolicy . You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.

Open ( Directory directory, IndexDeletionPolicy deletionPolicy, bool readOnly, int termInfosIndexDivisor ) : IndexReader

Expert: returns an IndexReader reading the index in the given Directory, with a custom IndexDeletionPolicy . You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.

Open ( Directory directory, bool readOnly ) : IndexReader

Returns an IndexReader reading the index in the given Directory. You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.

Open ( IndexCommit commit, IndexDeletionPolicy deletionPolicy, bool readOnly ) : IndexReader

Expert: returns an IndexReader reading the index in the given Directory, using a specific commit and with a custom IndexDeletionPolicy. You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.

Open ( IndexCommit commit, IndexDeletionPolicy deletionPolicy, bool readOnly, int termInfosIndexDivisor ) : IndexReader

Expert: returns an IndexReader reading the index in the given Directory, using a specific commit and with a custom IndexDeletionPolicy. You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.

Open ( IndexCommit commit, bool readOnly ) : IndexReader

Expert: returns an IndexReader reading the index in the given IndexCommit. You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.

Reopen ( ) : IndexReader

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: IndexReader reader = ... ... IndexReader newReader = r.reopen(); if (newReader != reader) { ... // reader was reopened reader.close(); } reader = newReader; ... Be sure to synchronize that code so that other threads, if present, can never use reader after it has been closed and before it's switched to newReader.

NOTE: If this reader is a near real-time reader (obtained from IndexWriter.GetReader(), reopen() will simply call writer.getReader() again for you, though this may change in the future.

Reopen ( IndexCommit commit ) : IndexReader

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.

Reopen ( bool openReadOnly ) : IndexReader

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.

SetNorm ( int doc, String field, byte value ) : void

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. NOTE: If this field does not store norms, then this method call will silently do nothing.

since this reader was opened

has this index open (write.lock could not be obtained)

SetNorm ( int doc, System field, float value ) : void

Expert: Resets the normalization factor for the named field of the named document.

since this reader was opened

has this index open (write.lock could not be obtained)

TermDocs ( ) : TermDocs

Returns an unpositioned Lucene.Net.Index.TermDocs enumerator.

TermDocs ( Term term ) : TermDocs

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:

Term    =>    <docNum, freq>*

The enumeration is ordered by document number. Each document number is greater than all that precede it in the enumeration.

TermPositions ( ) : TermPositions

Returns an unpositioned Lucene.Net.Index.TermPositions enumerator.

TermPositions ( Term term ) : TermPositions

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:

Term    =>    <docNum, freq, <pos1, pos2, ... posfreq-1> >*

This positional information facilitates phrase and proximity searching.

The enumeration is ordered by document number. Each document number is greater than all that precede it in the enumeration.

Terms ( ) : TermEnum

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.

Terms ( Term t ) : TermEnum

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.

UndeleteAll ( ) : void

Undeletes all documents currently marked as deleted in this index.

since this reader was opened

has this index open (write.lock could not be obtained)

this ( int doc ) : Lucene.Net.Documents.Document

Returns the stored fields of the nth 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.

보호된 메소드들

메소드 설명
AcquireWriteLock ( ) : void

Does nothing by default. Subclasses that require a write lock for index modifications must implement this method.

Dispose ( bool disposing ) : void
DoClose ( ) : void

Implements close.

DoCommit ( string>.IDictionary commitUserData ) : void

Implements commit.

DoDelete ( int docNum ) : void

Implements deletion of the document numbered docNum. Applications should call DeleteDocument(int) or DeleteDocuments(Term).

DoSetNorm ( int doc, System field, byte value_Renamed ) : void

Implements setNorm in subclass.

DoUndeleteAll ( ) : void

Implements actual undeleteAll() in subclass.

EnsureOpen ( ) : void
IndexReader ( ) : System

비공개 메소드들

메소드 설명
Close ( ) : void
Main ( String args ) : void
NumDocs ( ) : int
Open ( Directory directory, IndexDeletionPolicy deletionPolicy, IndexCommit commit, bool readOnly, int termInfosIndexDivisor ) : IndexReader

메소드 상세

AcquireWriteLock() 보호된 메소드

Does nothing by default. Subclasses that require a write lock for index modifications must implement this method.
protected AcquireWriteLock ( ) : void
리턴 void

Clone() 공개 메소드

Clones the IndexReader and optionally changes readOnly. A readOnly reader cannot open a writeable reader.
public Clone ( bool openReadOnly ) : IndexReader
openReadOnly bool
리턴 IndexReader

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.

public Clone ( ) : Object
리턴 System.Object

Commit() 공개 메소드

Commit changes resulting from delete, undeleteAll, or setNorm operations If an exception is hit, then either no changes or all changes will have been committed to the index (transactional semantics).
public Commit ( ) : void
리턴 void

Commit() 공개 메소드

Commit changes resulting from delete, undeleteAll, or setNorm operations If an exception is hit, then either no changes or all changes will have been committed to the index (transactional semantics).
public Commit ( string>.IDictionary commitUserData ) : void
commitUserData string>.IDictionary
리턴 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.
public DecRef ( ) : void
리턴 void

DeleteDocument() 공개 메소드

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. since this reader was opened has this index open (write.lock could not be obtained)
public DeleteDocument ( int docNum ) : void
docNum int
리턴 void

DeleteDocuments() 공개 메소드

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. since this reader was opened has this index open (write.lock could not be obtained)
public DeleteDocuments ( Lucene.Net.Index.Term term ) : int
term Lucene.Net.Index.Term
리턴 int

Directory() 공개 메소드

Returns the directory associated with this index. The Default implementation returns the directory specified by subclasses when delegating to the IndexReader(Directory) constructor, or throws an UnsupportedOperationException if one was not specified.
public Directory ( ) : Directory
리턴 System.IO.Directory

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.
public Dispose ( ) : void
리턴 void

Dispose() 보호된 메소드

protected Dispose ( bool disposing ) : void
disposing bool
리턴 void

DoClose() 보호된 추상적인 메소드

Implements close.
protected abstract DoClose ( ) : void
리턴 void

DoCommit() 보호된 추상적인 메소드

Implements commit.
protected abstract DoCommit ( string>.IDictionary commitUserData ) : void
commitUserData string>.IDictionary
리턴 void

DoDelete() 보호된 추상적인 메소드

Implements deletion of the document numbered docNum. Applications should call DeleteDocument(int) or DeleteDocuments(Term).
protected abstract DoDelete ( int docNum ) : void
docNum int
리턴 void

DoSetNorm() 보호된 추상적인 메소드

Implements setNorm in subclass.
protected abstract DoSetNorm ( int doc, System field, byte value_Renamed ) : void
doc int
field System
value_Renamed byte
리턴 void

DoUndeleteAll() 보호된 추상적인 메소드

Implements actual undeleteAll() in subclass.
protected abstract DoUndeleteAll ( ) : void
리턴 void

DocFreq() 공개 추상적인 메소드

Returns the number of documents containing the term t.
public abstract DocFreq ( Lucene.Net.Index.Term t ) : int
t Lucene.Net.Index.Term
리턴 int

Document() 공개 메소드

Returns the stored fields of the nth 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.

public Document ( int n ) : Lucene.Net.Documents.Document
n int
리턴 Lucene.Net.Documents.Document

Document() 공개 추상적인 메소드

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.

public abstract Document ( int n, Lucene.Net.Documents.FieldSelector fieldSelector ) : Lucene.Net.Documents.Document
n int Get the document at the nth position ///
fieldSelector Lucene.Net.Documents.FieldSelector The to use to determine what /// Fields should be loaded on the Document. May be null, in which case /// all Fields will be loaded. ///
리턴 Lucene.Net.Documents.Document

EnsureOpen() 보호된 메소드

protected EnsureOpen ( ) : void
리턴 void

Flush() 공개 메소드

public Flush ( ) : void
리턴 void

Flush() 공개 메소드

public Flush ( string>.IDictionary commitUserData ) : void
commitUserData string>.IDictionary Opaque Map (String -> String) /// that's recorded into the segments file in the index, /// and retrievable by ///. ///
리턴 void

GetCommitUserData() 공개 정적인 메소드

Reads commitUserData, previously passed to IndexWriter.Commit(System.Collections.Generic.IDictionary{string, string}), from current index segments file. This will return null if IndexWriter.Commit(System.Collections.Generic.IDictionary{string, string}) has never been called for this index.
public static GetCommitUserData ( Directory directory ) : IDictionary,System.Collections.Generic
directory System.IO.Directory where the index resides. ///
리턴 IDictionary,System.Collections.Generic

GetCurrentVersion() 공개 정적인 메소드

Reads version number from segments files. The version number is initialized with a timestamp and then increased by one for each change of the index.
public static GetCurrentVersion ( Directory directory ) : long
directory System.IO.Directory where the index resides. ///
리턴 long

GetFieldNames() 공개 추상적인 메소드

Get a list of unique field names that exist in this index and have the specified field option information.
public abstract GetFieldNames ( FieldOption fldOption ) : ICollection
fldOption FieldOption specifies which field option should be available for the returned fields ///
리턴 ICollection

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.

public GetSequentialSubReaders ( ) : Lucene.Net.Index.IndexReader[]
리턴 Lucene.Net.Index.IndexReader[]

GetTermFreqVector() 추상적인 공개 메소드

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 public GetTermFreqVector ( int docNumber, String field ) : ITermFreqVector
docNumber int document for which the term frequency vector is returned ///
field String field for which the term frequency vector is returned. ///
리턴 ITermFreqVector

GetTermFreqVector() 추상적인 공개 메소드

Load the Term Vector into a user-defined data structure instead of relying on the parallel arrays of the ITermFreqVector.
abstract public GetTermFreqVector ( int docNumber, String field, Lucene.Net.Index.TermVectorMapper mapper ) : void
docNumber int The number of the document to load the vector for ///
field String The name of the field to load ///
mapper Lucene.Net.Index.TermVectorMapper The to process the vector. Must not be null ///
리턴 void

GetTermFreqVector() 추상적인 공개 메소드

Map all the term vectors for all fields in a Document
abstract public GetTermFreqVector ( int docNumber, Lucene.Net.Index.TermVectorMapper mapper ) : void
docNumber int The number of the document to load the vector for ///
mapper Lucene.Net.Index.TermVectorMapper The to process the vector. Must not be null ///
리턴 void

GetTermFreqVectors() 추상적인 공개 메소드

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 contains terms and frequencies for all terms in a given vectorized field. If no such fields existed, the method returns null. The term vectors that are returned may either be of type ITermFreqVector or of type TermPositionVector if positions or offsets have been stored.
abstract public GetTermFreqVectors ( int docNumber ) : ITermFreqVector[]
docNumber int document for which term frequency vectors are returned ///
리턴 ITermFreqVector[]

HasNorms() 공개 메소드

Returns true if there are norms stored for this field.
public HasNorms ( System field ) : bool
field System
리턴 bool

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.
public IncRef ( ) : void
리턴 void

IndexExists() 공개 정적인 메소드

Returns true if an index exists at the specified directory. If the directory does not exist or if there is no index in it.
public static IndexExists ( Directory directory ) : bool
directory System.IO.Directory the directory to check for an index ///
리턴 bool

IndexReader() 보호된 메소드

protected IndexReader ( ) : System
리턴 System

IsCurrent() 공개 메소드

Check whether any new changes have occurred to the index since this reader was opened.

If this reader is based on a Directory (ie, was created by calling Open(Store.Directory) , or Reopen() on a reader based on a Directory), then this method checks if any further commits (see IndexWriter.Commit() have occurred in that directory).

If instead this reader is a near real-time reader (ie, obtained by a call to IndexWriter.GetReader(), or by calling Reopen() on a near real-time reader), then this method checks if either a new commmit has occurred, or any new uncommitted changes have taken place via the writer. Note that even if the writer has only performed merging, this method will still return false.

In any event, if this returns false, you should call Reopen() to get a new reader that sees the changes.

public IsCurrent ( ) : bool
리턴 bool

IsDeleted() 공개 추상적인 메소드

Returns true if document n has been deleted
public abstract IsDeleted ( int n ) : bool
n int
리턴 bool

IsOptimized() 공개 메소드

Checks is the index is optimized (if it has a single segment and no deletions). Not implemented in the IndexReader base class.
public IsOptimized ( ) : bool
리턴 bool

LastModified() 공개 정적인 메소드

Returns the time the index in the named directory was last modified. Do not use this to check whether the reader is still up-to-date, use IsCurrent() instead.
public static LastModified ( Directory directory2 ) : long
directory2 Directory
리턴 long

ListCommits() 공개 정적인 메소드

Returns all commit points that exist in the Directory. Normally, because the default is KeepOnlyLastCommitDeletionPolicy , there would be only one commit point. But if you're using a custom IndexDeletionPolicy then there could be many commits. Once you have a given commit, you can open a reader on it by calling IndexReader.Open(IndexCommit,bool) There must be at least one commit in the Directory, else this method throws System.IO.IOException. Note that if a commit is in progress while this method is running, that commit may or may not be returned array.
public static ListCommits ( Directory dir ) : System.Collections.Generic.ICollection
dir Directory
리턴 System.Collections.Generic.ICollection

Norms() 공개 추상적인 메소드

Returns the byte-encoded normalization factor for the named field of every document. This is used by the search code to score documents.
public abstract Norms ( System field ) : byte[]
field System
리턴 byte[]

Norms() 공개 추상적인 메소드

Reads the byte-encoded normalization factor for the named field of every document. This is used by the search code to score documents.
public abstract Norms ( System field, byte bytes, int offset ) : void
field System
bytes byte
offset int
리턴 void

Open() 공개 정적인 메소드

Expert: returns an IndexReader reading the index in the given Directory, with a custom IndexDeletionPolicy . You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.
public static Open ( Directory directory, IndexDeletionPolicy deletionPolicy, bool readOnly ) : IndexReader
directory Directory the index directory ///
deletionPolicy IndexDeletionPolicy a custom deletion policy (only used /// if you use this reader to perform deletes or to set /// norms); see for details. ///
readOnly bool true if no changes (deletions, norms) will be made with this IndexReader ///
리턴 IndexReader

Open() 공개 정적인 메소드

Expert: returns an IndexReader reading the index in the given Directory, with a custom IndexDeletionPolicy . You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.
public static Open ( Directory directory, IndexDeletionPolicy deletionPolicy, bool readOnly, int termInfosIndexDivisor ) : IndexReader
directory Directory the index directory ///
deletionPolicy IndexDeletionPolicy a custom deletion policy (only used /// if you use this reader to perform deletes or to set /// norms); see for details. ///
readOnly bool true if no changes (deletions, norms) will be made with this IndexReader ///
termInfosIndexDivisor int Subsamples which indexed /// terms are loaded into RAM. This has the same effect as /// IndexWriter.SetTermIndexInterval /// except that setting /// must be done at indexing time while this setting can be /// set per reader. When set to N, then one in every /// N*termIndexInterval terms in the index is loaded into /// memory. By setting this to a value > 1 you can reduce /// memory usage, at the expense of higher latency when /// loading a TermInfo. The default value is 1. Set this /// to -1 to skip loading the terms index entirely. ///
리턴 IndexReader

Open() 공개 정적인 메소드

Returns an IndexReader reading the index in the given Directory. You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.
CorruptIndexException if the index is corrupt IOException if there is a low-level IO error
public static Open ( Directory directory, bool readOnly ) : IndexReader
directory Directory the index directory
readOnly bool true if no changes (deletions, norms) will be made with this IndexReader
리턴 IndexReader

Open() 공개 정적인 메소드

Expert: returns an IndexReader reading the index in the given Directory, using a specific commit and with a custom IndexDeletionPolicy. You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.
public static Open ( IndexCommit commit, IndexDeletionPolicy deletionPolicy, bool readOnly ) : IndexReader
commit IndexCommit the specific to open; /// see to list all commits /// in a directory ///
deletionPolicy IndexDeletionPolicy a custom deletion policy (only used /// if you use this reader to perform deletes or to set /// norms); see for details. ///
readOnly bool true if no changes (deletions, norms) will be made with this IndexReader ///
리턴 IndexReader

Open() 공개 정적인 메소드

Expert: returns an IndexReader reading the index in the given Directory, using a specific commit and with a custom IndexDeletionPolicy. You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.
public static Open ( IndexCommit commit, IndexDeletionPolicy deletionPolicy, bool readOnly, int termInfosIndexDivisor ) : IndexReader
commit IndexCommit the specific to open; /// see to list all commits /// in a directory ///
deletionPolicy IndexDeletionPolicy a custom deletion policy (only used /// if you use this reader to perform deletes or to set /// norms); see for details. ///
readOnly bool true if no changes (deletions, norms) will be made with this IndexReader ///
termInfosIndexDivisor int Subsambles which indexed /// terms are loaded into RAM. This has the same effect as /// IndexWriter.SetTermIndexInterval /// except that setting /// must be done at indexing time while this setting can be /// set per reader. When set to N, then one in every /// N*termIndexInterval terms in the index is loaded into /// memory. By setting this to a value > 1 you can reduce /// memory usage, at the expense of higher latency when /// loading a TermInfo. The default value is 1. Set this /// to -1 to skip loading the terms index entirely. ///
리턴 IndexReader

Open() 공개 정적인 메소드

Expert: returns an IndexReader reading the index in the given IndexCommit. You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the reader.
public static Open ( IndexCommit commit, bool readOnly ) : IndexReader
commit IndexCommit the commit point to open ///
readOnly bool true if no changes (deletions, norms) will be made with this IndexReader ///
리턴 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: IndexReader reader = ... ... IndexReader newReader = r.reopen(); if (newReader != reader) { ... // reader was reopened reader.close(); } reader = newReader; ... Be sure to synchronize that code so that other threads, if present, can never use reader after it has been closed and before it's switched to newReader.

NOTE: If this reader is a near real-time reader (obtained from IndexWriter.GetReader(), reopen() will simply call writer.getReader() again for you, though this may change in the future.

public Reopen ( ) : IndexReader
리턴 IndexReader

Reopen() 공개 메소드

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.
public Reopen ( IndexCommit commit ) : IndexReader
commit IndexCommit
리턴 IndexReader

Reopen() 공개 메소드

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.
public Reopen ( bool openReadOnly ) : IndexReader
openReadOnly bool
리턴 IndexReader

SetNorm() 공개 메소드

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. NOTE: If this field does not store norms, then this method call will silently do nothing. since this reader was opened has this index open (write.lock could not be obtained)
public SetNorm ( int doc, String field, byte value ) : void
doc int
field String
value byte
리턴 void

SetNorm() 공개 메소드

Expert: Resets the normalization factor for the named field of the named document. since this reader was opened has this index open (write.lock could not be obtained)
public SetNorm ( int doc, System field, float value ) : void
doc int
field System
value float
리턴 void

TermDocs() 공개 추상적인 메소드

Returns an unpositioned Lucene.Net.Index.TermDocs enumerator.
public abstract TermDocs ( ) : TermDocs
리턴 TermDocs

TermDocs() 공개 메소드

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:

Term    =>    <docNum, freq>*

The enumeration is ordered by document number. Each document number is greater than all that precede it in the enumeration.

public TermDocs ( Term term ) : TermDocs
term Term
리턴 TermDocs

TermPositions() 공개 추상적인 메소드

Returns an unpositioned Lucene.Net.Index.TermPositions enumerator.
public abstract TermPositions ( ) : TermPositions
리턴 TermPositions

TermPositions() 공개 메소드

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:

Term    =>    <docNum, freq, <pos1, pos2, ... posfreq-1> >*

This positional information facilitates phrase and proximity searching.

The enumeration is ordered by document number. Each document number is greater than all that precede it in the enumeration.

public TermPositions ( Term term ) : TermPositions
term Term
리턴 TermPositions

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.
public abstract Terms ( ) : TermEnum
리턴 TermEnum

Terms() 공개 추상적인 메소드

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.
public abstract Terms ( Term t ) : TermEnum
t Term
리턴 TermEnum

UndeleteAll() 공개 메소드

Undeletes all documents currently marked as deleted in this index. since this reader was opened has this index open (write.lock could not be obtained)
public UndeleteAll ( ) : void
리턴 void

this() 공개 메소드

Returns the stored fields of the nth 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.

public this ( int doc ) : Lucene.Net.Documents.Document
doc int
리턴 Lucene.Net.Documents.Document

프로퍼티 상세

DEFAULT_TERMS_INDEX_DIVISOR 보호되어 있는 정적으로 프로퍼티

protected static int DEFAULT_TERMS_INDEX_DIVISOR
리턴 int

hasChanges 보호되어 있는 프로퍼티

protected bool hasChanges
리턴 bool