Correct text output & sort results by rank
This commit is contained in:
parent
c450051218
commit
53e4403356
2 changed files with 4 additions and 4 deletions
|
@ -124,7 +124,7 @@ namespace LibSearchBox
|
|||
});
|
||||
|
||||
List<SearchResult> results = new List<SearchResult>(resultsRaw.AsEnumerable());
|
||||
results.OrderBy((SearchResult result) => result.Rank);
|
||||
results.Sort((SearchResult a, SearchResult b) => (int)Math.Round(b.Rank - a.Rank));
|
||||
return results;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ namespace LibSearchBox
|
|||
public override string ToString()
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.AppendLine($"{Rank.ToString().PadLeft(5)}: {PageName}");
|
||||
result.Append($" {string.Join(", ", Offsets.Select((SearchOffset nextOffset) => $"{nextOffset.Term} @ {nextOffset.Offset}"))}");
|
||||
return base.ToString();
|
||||
result.AppendLine($"{PageName} - ({Rank} points)");
|
||||
result.Append($" {string.Join(", ", Offsets.Select((SearchOffset nextOffset) => $"{nextOffset.Offset}:{nextOffset.Term}"))}");
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue