Logo Search packages:      
Sourcecode: beagle version File versions  Download package

Lucene::Net::Index::IndexReader Class Reference

Inheritance diagram for Lucene::Net::Index::IndexReader:

Lucene::Net::Index::FilterIndexReader Lucene::Net::Index::MultiReader Lucene::Net::Index::ParallelReader Lucene::Net::Index::SegmentReader

List of all members.


Detailed Description

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.

Concrete subclasses of IndexReader are usually constructed with a call to one of the static

open()
methods, e.g. Open(String).

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.

An IndexReader can be opened on a directory for which an IndexWriter is opened already, but it cannot be used to delete documents from the index then.

<author> Doug Cutting </author> <version>

Id
IndexReader.cs,v 1.4 2006/10/02 17:08:52 joeshaw Exp
</version>

Definition at line 47 of file IndexReader.cs.


Public Member Functions

void Close ()
 Closes files associated with this index. Also saves any new deletions to disk. No other methods should be called after this has been called.
int Delete (Term term)
 Deletes all documents containing
term
. 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 Delete(int) for information about when this deletion will become effective.
void Delete (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 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.
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 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.
int DeleteDocuments (Term term)
 Deletes all documents containing
term
. 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 Delete(int) for information about when this deletion will become effective.
virtual Directory Directory ()
 Returns the directory this index resides in.
abstract int DocFreq (Term t)
 Returns the number of documents containing the term
t
.
abstract Document Document (int n)
 Returns the stored fields of the
n
th in this index.
abstract
System.Collections.ICollection 
GetFieldNames (FieldOption fldOption)
 Get a list of unique field names that exist in this index and have the specified field option information.
abstract
System.Collections.ICollection 
GetFieldNames (bool indexed)
 Returns a list of all unique field names that exist in the index pointed to by this IndexReader. The boolean argument specifies whether the fields returned are indexed or not.
abstract
System.Collections.ICollection 
GetFieldNames ()
 Returns a list of all unique field names that exist in the index pointed to by this IndexReader.
abstract
System.Collections.ICollection 
GetIndexedFieldNames (Field.TermVector tvSpec)
 Get a list of unique field names that exist in this index, are indexed, and have the specified term vector information.
virtual
System.Collections.ICollection 
GetIndexedFieldNames (bool storedTermVector)
abstract TermFreqVector GetTermFreqVector (int docNumber, System.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 TermPositionsVector is returned.
abstract TermFreqVector[] 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 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 my either be of type TermFreqVector or of type TermPositionsVector if positions or offsets have been stored.
virtual long GetVersion ()
 Version number when this IndexReader was opened.
abstract bool HasDeletions ()
 Returns true if any documents have been deleted.
virtual bool HasNorms (System.String field)
 Returns true if there are norms stored for this field.
virtual bool IsCurrent ()
 Check whether this IndexReader still works on a current version of the index. If this is not the case you will need to re-open the IndexReader to make sure you see the latest changes made to the index.
abstract bool IsDeleted (int n)
 Returns true if document n has been deleted.
abstract int MaxDoc ()
 Returns one greater than the largest possible document number. This may be used to, e.g., determine how big to allocate an array which will have an element for every document number in an index.
abstract void Norms (System.String field, byte[] bytes, int offset)
 Reads the byte-encoded normalization factor for the named field of every document. This is used by the search code to score documents.
abstract 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.
abstract int NumDocs ()
 Returns the number of documents in this index.
virtual void SetNorm (int doc, System.String field, float value_Renamed)
 Expert: Resets the normalization factor for the named field of the named document.
void SetNorm (int doc, System.String field, byte value_Renamed)
 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 int) length normalization. Thus, to preserve the length normalization values when resetting this, one should base the new value upon the old.
abstract TermDocs TermDocs ()
 Returns an unpositioned TermDocs enumerator.
virtual 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. Thus, this method implements the mapping:.
abstract TermPositions TermPositions ()
 Returns an unpositioned TermPositions enumerator.
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:.
abstract TermEnum Terms (Term t)
 Returns an enumeration of all terms after a given term. The enumeration is ordered by Term.compareTo(). Each term is greater than all that precede it in the enumeration.
abstract 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.
void UndeleteAll ()
 Undeletes all documents currently marked as deleted in this index.

Static Public Member Functions

static long GetCurrentVersion (Directory directory)
 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.
static long GetCurrentVersion (System.IO.FileInfo directory)
 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.
static long GetCurrentVersion (System.String directory)
 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.
static bool IndexExists (Directory directory)
 Returns
true
if an index exists at the specified directory. If the directory does not exist or if there is no index in it.
static bool IndexExists (System.IO.FileInfo directory)
 Returns
true
if an index exists at the specified directory. If the directory does not exist or if there is no index in it.
static bool IndexExists (System.String directory)
 Returns
true
if an index exists at the specified directory. If the directory does not exist or if there is no index in it.
false
is returned.
static bool IsLocked (System.String directory)
 Returns
true
iff the index in the named directory is currently locked.
static bool IsLocked (Directory directory)
 Returns
true
iff the index in the named directory is currently locked.
static long LastModified (Directory directory)
 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.
static long LastModified (System.IO.FileInfo directory)
 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.
static long LastModified (System.String directory)
 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.
static void Main (System.String[] args)
 Prints the filename and size of each file within a given compound file. Add the -extract flag to extract files to the current working directory. In order to make the extracted version of the index work, you have to copy the segments file from the compound index into the directory where the extracted files are stored.
static IndexReader Open (Directory directory)
 Returns an IndexReader reading the index in the given Directory.
static IndexReader Open (System.IO.FileInfo path)
 Returns an IndexReader reading the index in an FSDirectory in the named path.
static IndexReader Open (System.String path)
 Returns an IndexReader reading the index in an FSDirectory in the named path.
static void Unlock (Directory directory)
 Forcibly unlocks the index in the named directory.

Protected Member Functions

internal void Commit ()
 Commit changes resulting from delete, undeleteAll, or setNorm operations.
abstract internal void DoClose ()
 Implements close.
abstract internal void DoCommit ()
 Implements commit.
abstract internal void DoDelete (int docNum)
 Implements deletion of the document numbered
docNum
. Applications should call Delete(int) or Delete(Term).
abstract internal void DoSetNorm (int doc, System.String field, byte value_Renamed)
 Implements setNorm in subclass.
abstract internal void DoUndeleteAll ()
 Implements actual undeleteAll() in subclass.
internal IndexReader (Directory directory)
 Constructor used if IndexReader is not owner of its directory. This is used for IndexReaders that are used within other IndexReaders that take care or locking directories.

Private Member Functions

void AquireWriteLock ()
 Tries to acquire the WriteLock on this directory. this method is only valid if this IndexReader is directory owner.
internal IndexReader (Directory directory, SegmentInfos segmentInfos, bool closeDirectory)
 Constructor used if IndexReader is owner of its directory. If IndexReader is owner of its directory, it locks its directory in case of write operations.
virtual internal void Init (Directory directory, SegmentInfos segmentInfos, bool closeDirectory, bool directoryOwner)
 ~IndexReader ()
 Release the write lock, if needed.

Static Private Member Functions

static IndexReader Open (Directory directory, bool closeDirectory)

Private Attributes

bool closeDirectory
Directory directory
bool directoryOwner
bool hasChanges
SegmentInfos segmentInfos
bool stale
Lock writeLock

Classes

class  AnonymousClassWith
class  AnonymousClassWith1
class  FieldOption

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index