Fixed issue in search engine (multiple identical matches returned when search query contained the same work multiple times).
This commit is contained in:
parent
4bb5211191
commit
e225f06bd1
6 changed files with 45 additions and 5 deletions
|
@ -78,6 +78,23 @@ namespace ScrewTurn.Wiki.SearchEngine {
|
|||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a word occurrence is in the collection.
|
||||
/// </summary>
|
||||
/// <param name="word">The word.</param>
|
||||
/// <param name="firstCharIndex">The index of the first character.</param>
|
||||
/// <returns><c>True</c> if the collection contains the occurrence, <c>false</c> otherwise.</returns>
|
||||
public bool ContainsOccurrence(string word, int firstCharIndex) {
|
||||
if(string.IsNullOrEmpty(word)) return false;
|
||||
if(firstCharIndex < 0) return false;
|
||||
|
||||
foreach(WordInfo w in items) {
|
||||
if(w.Text == word && w.FirstCharIndex == firstCharIndex) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the collection items to an array.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue