Assigns a document score based on term frequency.
If you add a MatchScorer to a SortOptions as in the following code:
sort_opts = search.SortOptions(match_scorer=search.MatchScorer())
then, this will sort the documents in descending score order. The scores
will be positive. If you want to sort in ascending order, then use the
following code:
sort_opts = search.SortOptions(match_scorer=search.MatchScorer(),
expressions=[search.SortExpression(
expression='_score', direction=search.SortExpression.ASCENDING,
default_value=0.0)])
The scores in this case will be negative.