using System; using System.Collections.Generic; using System.Data.Common; using System.Linq; using System.Text; using ScrewTurn.Wiki.SearchEngine; namespace ScrewTurn.Wiki.Plugins.SqlCommon { /// /// Defines the interface for a connector between an index to a pages storage provider. /// public interface IIndexConnector { /// /// Invokes the GetWordFetcher delegate. /// /// The word fetcher. IWordFetcher GetWordFetcher(); /// /// Defines a delegate for a method that gets the size of the approximate index in bytes. /// /// The size of the index, in bytes. long GetSize(); /// /// Invokes the GetCount delegate. /// /// The element type. /// The element count. int GetCount(IndexElementType element); /// /// Invokes the ClearIndex delegate. /// /// A state object passed from the index. void ClearIndex(object state); /// /// Invokes the DeleteDataForDocument delegate. /// /// The document. /// A state object passed from the index. void DeleteDataForDocument(IDocument document, object state); /// /// Invokes the SaveDataForDocument delegate. /// /// The document. /// The content words. /// The title words. /// The keywords. /// A state object passed from the index. /// The number of stored occurrences. int SaveDataForDocument(IDocument document, WordInfo[] content, WordInfo[] title, WordInfo[] keywords, object state); } /// /// Defines a delegate for a method for getting a word fetcher. /// /// The word fetcher. public delegate IWordFetcher GetWordFetcher(); /// /// Defines a delegate for a method that gets the size of the approximate index in bytes. /// /// The size of the index, in bytes. public delegate long GetSize(); /// /// Defines a delegate for a method that counts elements in the index. /// /// The element type. /// The element count. public delegate int GetCount(IndexElementType element); /// /// Defines a delegate for method that clears the index. /// /// A state object passed from the index. public delegate void ClearIndex(object state); /// /// Defines a delegate for a method for saving data. The passed data is the whole document data, as it was tokenized. /// /// The document. /// The content words. /// The title words. /// The keywords. /// A state object passed from the index. /// The number of stored occurrences. public delegate int SaveDataForDocument(IDocument document, WordInfo[] content, WordInfo[] title, WordInfo[] keywords, object state); /// /// Defines a delegate for a method for deleting a document's data. /// /// The document. /// A state object passed from the index. public delegate void DeleteDataForDocument(IDocument document, object state); /// /// Defines a delegate for a method for finding a word. /// /// The word text. /// The returned word. /// An open database connection. /// true if the word is found, false otherwise. public delegate bool TryFindWord(string text, out Word word, DbConnection connection); /// /// Defines legal index element types. /// public enum IndexElementType { /// /// The documents. /// Documents, /// /// The words. /// Words, /// /// The occurrences. /// Occurrences } }