Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



class MatchScorer

Class MatchScorer allows you to sort documents based on the quality of query match. The scorer assigns a score based on term frequency in a document.

To use a MatchScorer , add it to the SortOptions as in the following code:

  sort_opts = search.SortOptions(match_scorer=search.MatchScorer())

This sorts 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.

MatchScorer is defined in the google.appengine.api.search module.

  1. Constructor

Constructor

The constructor for class MatchScorer is defined as follows:

class MatchScorer ()

Assigns a document score to search results representing how well they match the query, base on frequency of terms in the document.

Result value

A new instance of class MatchScorer .

Exceptions

TypeError

If any of the parameters have an invalid type, or an unknown attribute is passed.

ValueError

If any parameter has an invalid value.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.