Hyperspace Docs

Score Function Commands

Hyperspace supports several filtering methods, both range-match based and keyword-match based.
The filtering is only performed at the external conditions stack, that is, only the external “if” conditions will affect the candidates list. The final candidate list can then be created using additional filters and scores.
As an example, only line 4 in the following query will create candidates, while line 7 will allow to modify candidate score but will not change the overall candidate list
1 def score_function_recommendation( Q, V):
2 score1 = 0.0
3 score0 = 1.0
4 if match('genres'):
5 score1 += rarity_sum('genres')
6 sum_score = score1 + score2
7 if match('collection'):
8 sum_score += 10
9 return boost * sum_score
10 return 0.0