Fixed issue in search engine (multiple identical matches returned when search query contained the same work multiple times).

This commit is contained in:
Dario Solera 2009-10-02 08:00:55 +00:00
parent 4bb5211191
commit e225f06bd1
6 changed files with 45 additions and 5 deletions

View file

@ -61,7 +61,10 @@ namespace ScrewTurn.Wiki.SearchEngine {
results.Add(res);
}
else {
res.Matches.Add(mi);
// Avoid adding duplicate matches (happens when query contains the same word multiple times)
if(!res.Matches.ContainsOccurrence(mi.Text, mi.FirstCharIndex)) {
res.Matches.Add(mi);
}
res.Relevance.SetValue(res.Relevance.Value + info.Location.RelativeRelevance);
}
totalRelevance += info.Location.RelativeRelevance;