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
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue