get sorting of query result right

This commit is contained in:
2019-05-08 15:18:30 +02:00
parent 10b775cdc9
commit cde0238d62
4 changed files with 40 additions and 8 deletions

View File

@ -36,11 +36,13 @@ impl Query {
}
if score >= required_score {
results.push((score, texture))
// multiply by -1 to get order right.
results.push((score * -1, texture))
}
}
results.sort_by_key(|(score, _)| score * -1);
// We can sort unstable, since at least the IDs are different.
results.sort_unstable();
results
.iter()