C# 클래스 ScrewTurn.Wiki.SearchEngine.InMemoryIndexBase

Implements a base class for the search index.
All instance and static members are thread-safe.
상속: IInMemoryIndex
파일 보기 프로젝트 열기: mono/ScrewTurnWiki 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
buildDocument BuildDocument
catalog Word>.Dictionary
stopWords string[]

공개 메소드들

메소드 설명
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.

보호된 메소드들

메소드 설명
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.

비공개 메소드들

메소드 설명
FindDocument ( string name ) : IDocument

Finds a document with a specified name.

메소드 상세

Clear() 공개 메소드

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.
리턴 void

InMemoryIndexBase() 공개 메소드

Initializes a new instance of the InMemoryIndexBase class.
public InMemoryIndexBase ( ) : System
리턴 System

InitializeData() 공개 메소드

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.
리턴 void

OnIndexChange() 보호된 메소드

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.
리턴 IndexStorerResult

RemoveDocument() 공개 메소드

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.
리턴 void

RemoveDocumentInternal() 보호된 메소드

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

Search() 공개 메소드

Performs a search in the index.
If is null.
public Search ( SearchParameters parameters ) : SearchResultCollection
parameters SearchParameters The search parameters.
리턴 SearchResultCollection

SetBuildDocumentDelegate() 공개 메소드

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).
리턴 void

StoreDocument() 공개 메소드

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.
리턴 int

StoreWord() 보호된 메소드

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.
리턴 DumpedWordMapping

프로퍼티 상세

buildDocument 보호되어 있는 프로퍼티

The BuildDocument delegate.
protected BuildDocument buildDocument
리턴 BuildDocument

catalog 보호되어 있는 프로퍼티

Contains the index catalog.
protected Dictionary catalog
리턴 Word>.Dictionary

stopWords 보호되어 있는 프로퍼티

The stop words to be used while indexing new content.
protected string[] stopWords
리턴 string[]