C# Class ScrewTurn.Wiki.SearchEngine.Tools

Implements useful methods.
Mostrar archivo Open project: mono/ScrewTurnWiki Class Usage Examples

Public Methods

Method Description
CleanupKeywords ( string keywords ) : string[]

Cleans up keyworks from invalid characters.

IsDocumentTypeTagIncluded ( string currentTag, string includedTags ) : bool

Determines whether a document tag is contained in a tag array.

The comparison is case-insensitive.

IsSplitChar ( char current ) : bool

Determines whether a char is a split char.

PurgeResultsForAllWords ( SearchResultCollection results, string queryWords ) : float

Purges the invalid results when SearchOptions is AllWords.

PurgeResultsForExactPhrase ( SearchResultCollection results, string queryWords ) : float

Purges the invalid results when SearchOptions is ExactPhrase.

RemoveDiacriticsAndPunctuation ( string input, bool isSingleWord ) : string

Removes "accents" and punctuation from a string, transforming it to lowercase (culture invariant).

RemoveStopWords ( WordInfo words, string stopWords ) : WordInfo[]

Removes stop words from a set of words (case insensitive).

SearchInternal ( string query, string documentTypeTags, bool filterDocumentType, SearchOptions options, IWordFetcher fetcher ) : SearchResultCollection

Performs a search in the index.

SkipSplitChars ( ushort startIndex, string content ) : ushort

Computes the index of the first non-split char given a start index.

Tokenize ( string text ) : WordInfo[]

Tokenizes a string.

Tokenize ( string text, WordLocation location ) : WordInfo[]

Tokenizes a string.

Method Details

CleanupKeywords() public static method

Cleans up keyworks from invalid characters.
public static CleanupKeywords ( string keywords ) : string[]
keywords string The keywords to cleanup.
return string[]

IsDocumentTypeTagIncluded() public static method

Determines whether a document tag is contained in a tag array.
The comparison is case-insensitive.
public static IsDocumentTypeTagIncluded ( string currentTag, string includedTags ) : bool
currentTag string The tag to check for.
includedTags string The tag array.
return bool

IsSplitChar() public static method

Determines whether a char is a split char.
public static IsSplitChar ( char current ) : bool
current char The current char.
return bool

PurgeResultsForAllWords() public static method

Purges the invalid results when SearchOptions is AllWords.
public static PurgeResultsForAllWords ( SearchResultCollection results, string queryWords ) : float
results SearchResultCollection The results to purge.
queryWords string The query words.
return float

PurgeResultsForExactPhrase() public static method

Purges the invalid results when SearchOptions is ExactPhrase.
public static PurgeResultsForExactPhrase ( SearchResultCollection results, string queryWords ) : float
results SearchResultCollection The results to purge.
queryWords string The query words.
return float

RemoveDiacriticsAndPunctuation() public static method

Removes "accents" and punctuation from a string, transforming it to lowercase (culture invariant).
public static RemoveDiacriticsAndPunctuation ( string input, bool isSingleWord ) : string
input string The input string.
isSingleWord bool A value indicating whether the input string is a single word.
return string

RemoveStopWords() public static method

Removes stop words from a set of words (case insensitive).
If or are null.
public static RemoveStopWords ( WordInfo words, string stopWords ) : WordInfo[]
words WordInfo The input words.
stopWords string The array of stop words.
return WordInfo[]

SearchInternal() public static method

Performs a search in the index.
If or are null. If is empty. If is true and is null. If is true and is empty.
public static SearchInternal ( string query, string documentTypeTags, bool filterDocumentType, SearchOptions options, IWordFetcher fetcher ) : SearchResultCollection
query string The search query.
documentTypeTags string The document type tags to include in the search.
filterDocumentType bool true to apply the filter on the document type.
options SearchOptions The search options.
fetcher IWordFetcher An object that is able to fetch words.
return SearchResultCollection

SkipSplitChars() public static method

Computes the index of the first non-split char given a start index.
If is null.
public static SkipSplitChars ( ushort startIndex, string content ) : ushort
startIndex ushort The start index.
content string The content.
return ushort

Tokenize() public static method

Tokenizes a string.
public static Tokenize ( string text ) : WordInfo[]
text string The text to tokenize.
return WordInfo[]

Tokenize() public static method

Tokenizes a string.
If is null.
public static Tokenize ( string text, WordLocation location ) : WordInfo[]
text string The text to tokenize.
location WordLocation The location of the words that are extracted.
return WordInfo[]