nitc :: IndexMatches :: sort
comparator
(or a list of comparators)Return a new IndexMatches instance with the sorted results.
When more than one comparator is given, the comparators are applied in a
pipeline where the n
th comparator is applied only if the n-1
th comparator
returned 0.
# Sort the matches with `comparator` (or a list of comparators)
#
# Return a new IndexMatches instance with the sorted results.
#
# When more than one comparator is given, the comparators are applied in a
# pipeline where the `n`th comparator is applied only if the `n-1`th comparator
# returned 0.
fun sort(comparator: ScoreComparator...): IndexMatches do
var res = to_a
if comparator.length == 1 then
comparator.first.sort res
else
var comparators = new MatchComparators(comparator)
comparators.sort res
end
return new IndexMatches.from_matches(res)
end
src/model/model_index.nit:451,2--467,4