C# Class ScrewTurn.Wiki.SearchEngine.InMemoryIndexBase

Implements a base class for the search index.
All instance and static members are thread-safe.
Inheritance: IInMemoryIndex
Afficher le fichier Open project: mono/ScrewTurnWiki Class Usage Examples

Protected Properties

Свойство Type Description
buildDocument BuildDocument
catalog Word>.Dictionary
stopWords string[]

Méthodes publiques

Méthode Description
Clear ( object state ) : void

Completely clears the index (stop words are not affected).

InMemoryIndexBase ( ) : System

Initializes a new instance of the InMemoryIndexBase class.

InitializeData ( DumpedDocument documents, DumpedWord words, DumpedWordMapping mappings ) : void

Initializes index data by completely emptying the index catalog and storing the specified data.

The method does not check the consistency of the data passed as arguments.

RemoveDocument ( IDocument document, object state ) : void

Removes a document from the index.

Search ( SearchParameters parameters ) : SearchResultCollection

Performs a search in the index.

SetBuildDocumentDelegate ( BuildDocument buildDocument ) : void

Sets the delegate used for converting a DumpedDocument to an instance of a class implementing IDocument, while reading index data from a permanent storage.

This method must be called before invoking InitializeData.

StoreDocument ( IDocument document, string keywords, string content, object state ) : int

Stores a document in the index.

Indexing the content of the document is O(n), where n is the total number of words in the document. If the specified document was already in the index, all the old occurrences are deleted from the index.

Méthodes protégées

Méthode Description
OnIndexChange ( IDocument document, IndexChangeType change, DumpedChange changeData, object state ) : IndexStorerResult

Takes care of firing the IndexChanged event.

RemoveDocumentInternal ( IDocument document ) : DumpedChange

Removes a document from the index and generates the dumped change data.

StoreWord ( string wordText, IDocument document, ushort firstCharIndex, ushort wordIndex, WordLocation location, Word &newWord, DumpedWord &dumpedWord ) : DumpedWordMapping

Stores a word in the catalog.

Storing a word in the index is O(n log n), where n is the number of words already in the index.

Private Methods

Méthode Description
FindDocument ( string name ) : IDocument

Finds a document with a specified name.

Method Details

Clear() public méthode

Completely clears the index (stop words are not affected).
public Clear ( object state ) : void
state object A state object that is passed to the IndexStorer SaveDate/DeleteData function.
Résultat void

InMemoryIndexBase() public méthode

Initializes a new instance of the InMemoryIndexBase class.
public InMemoryIndexBase ( ) : System
Résultat System

InitializeData() public méthode

Initializes index data by completely emptying the index catalog and storing the specified data.
The method does not check the consistency of the data passed as arguments.
If , or are null. If was not called.
public InitializeData ( DumpedDocument documents, DumpedWord words, DumpedWordMapping mappings ) : void
documents DumpedDocument The documents.
words DumpedWord The words.
mappings DumpedWordMapping The mappings.
Résultat void

OnIndexChange() protected méthode

Takes care of firing the IndexChanged event.
protected OnIndexChange ( IDocument document, IndexChangeType change, DumpedChange changeData, object state ) : IndexStorerResult
document IDocument The affected document.
change IndexChangeType The change performed.
changeData DumpedChange The dumped change data.
state object A state object that is passed to the IndexStorer SaveDate/DeleteData function.
Résultat IndexStorerResult

RemoveDocument() public méthode

Removes a document from the index.
If is null.
public RemoveDocument ( IDocument document, object state ) : void
document IDocument The document to remove.
state object A state object that is passed to the IndexStorer SaveDate/DeleteData function.
Résultat void

RemoveDocumentInternal() protected méthode

Removes a document from the index and generates the dumped change data.
protected RemoveDocumentInternal ( IDocument document ) : DumpedChange
document IDocument The document to remove.
Résultat DumpedChange

Search() public méthode

Performs a search in the index.
If is null.
public Search ( SearchParameters parameters ) : SearchResultCollection
parameters SearchParameters The search parameters.
Résultat SearchResultCollection

SetBuildDocumentDelegate() public méthode

Sets the delegate used for converting a DumpedDocument to an instance of a class implementing IDocument, while reading index data from a permanent storage.
This method must be called before invoking InitializeData.
If is null.
public SetBuildDocumentDelegate ( BuildDocument buildDocument ) : void
buildDocument BuildDocument The delegate (cannot be null).
Résultat void

StoreDocument() public méthode

Stores a document in the index.
Indexing the content of the document is O(n), where n is the total number of words in the document. If the specified document was already in the index, all the old occurrences are deleted from the index.
If or are null.
public StoreDocument ( IDocument document, string keywords, string content, object state ) : int
document IDocument The document.
keywords string The document keywords, if any, an empty array or null otherwise.
content string The content of the document.
state object A state object that is passed to the IndexStorer SaveDate/DeleteData function.
Résultat int

StoreWord() protected méthode

Stores a word in the catalog.
Storing a word in the index is O(n log n), where n is the number of words already in the index.
protected StoreWord ( string wordText, IDocument document, ushort firstCharIndex, ushort wordIndex, WordLocation location, Word &newWord, DumpedWord &dumpedWord ) : DumpedWordMapping
wordText string The word to store.
document IDocument The document the word occurs in.
firstCharIndex ushort The index of the first character of the word in the document the word occurs at.
wordIndex ushort The index of the word in the document.
location WordLocation The location of the word.
newWord Word The new word, or null.
dumpedWord DumpedWord The dumped word data, or null.
Résultat DumpedWordMapping

Property Details

buildDocument protected_oe property

The BuildDocument delegate.
protected BuildDocument buildDocument
Résultat BuildDocument

catalog protected_oe property

Contains the index catalog.
protected Dictionary catalog
Résultat Word>.Dictionary

stopWords protected_oe property

The stop words to be used while indexing new content.
protected string[] stopWords
Résultat string[]