Is it possible to implement a custom MatchScorer?

36 views
Skip to first unread message

Ivo Bellin Salarin

unread,
Feb 14, 2017, 9:40:44 AM2/14/17
to google-a...@googlegroups.com
Hello everybody,

I a using the python GAE. I would like to implement a custom match scorer which sorts a set of documents according to their timestamp (taking into account an eventual periodicity of the events; e.g. a sport competition which takes place every year).

In search.py I can find two empty implementations of a MatchScorer (the RescoringMatchScorer and the MatchScorer itself), so I concluded that they're just stubs for a real implementation elsewhere.

So, is it possible to implement a custom MatchScorer?

Thanks in advance,
Ivo

Adam (Cloud Platform Support)

unread,
Feb 14, 2017, 1:25:57 PM2/14/17
to Google App Engine
The MatchScorer (and RescoringMatchScorer) class is 'empty' because it just denotes an option that you can pass to search.SortOptions. You can see how it's used further down in search.py in the method _CopyMatchScorerToScorerSpecProtocolBuffer, where the type is simply checked and an option is set in the protocol buffer accordingly for when the search service is called.

So this answers your question of whether it's possible to implement a custom scorer - no, because the actual scoring is done on the service side at the other end of an RPC, and the option passed must be one of those two classes. The service does work as documented however.
Reply all
Reply to author
Forward
0 new messages