Update SearchScore and use AsParallel

This commit is contained in:
2023-08-26 19:39:28 +02:00
parent ba71618463
commit c0a6f16374
3 changed files with 23 additions and 18 deletions

View File

@ -266,6 +266,8 @@ namespace Elwig.Windows {
filter.RemoveAt(i--);
} else if (e.Length > 2 && e.StartsWith("\"") && e.EndsWith("\"")) {
filter[i] = e[1..^1];
} else if (e.Length <= 2) {
filter.RemoveAt(i--);
}
}
@ -286,7 +288,7 @@ namespace Elwig.Windows {
List<Delivery> deliveries = await deliveryQuery.OrderByDescending(d => d.DateString).ThenByDescending(d => d.TimeString).ToListAsync();
if (filter.Count > 0 && deliveries.Count > 0) {
var dict = deliveries
var dict = deliveries.AsParallel()
.ToDictionary(d => d, d => d.SearchScore(TextFilter))
.OrderByDescending(a => a.Value)
.ThenBy(a => a.Key.DateTime);