forked from LBRYCommunity/lbry-sdk
make app backward compatible with trending_score
-update trending decay function to zero out low trending score values faster
This commit is contained in:
parent
acaf299bcb
commit
db2789990f
2 changed files with 2 additions and 1 deletions
|
@ -73,6 +73,7 @@ RANGE_FIELDS = {
|
||||||
ALL_FIELDS = RANGE_FIELDS | TEXT_FIELDS | FIELDS
|
ALL_FIELDS = RANGE_FIELDS | TEXT_FIELDS | FIELDS
|
||||||
|
|
||||||
REPLACEMENTS = {
|
REPLACEMENTS = {
|
||||||
|
'trending_mixed': 'trending_score'
|
||||||
# 'name': 'normalized_name',
|
# 'name': 'normalized_name',
|
||||||
'txid': 'tx_id',
|
'txid': 'tx_id',
|
||||||
'nout': 'tx_nout',
|
'nout': 'tx_nout',
|
||||||
|
|
|
@ -183,7 +183,7 @@ class SearchIndex:
|
||||||
decay_factor = 2 * (2.0 ** (-1 / self._trending_half_life))
|
decay_factor = 2 * (2.0 ** (-1 / self._trending_half_life))
|
||||||
decay_script = """
|
decay_script = """
|
||||||
if (ctx._source.trending_score == null) { ctx._source.trending_score = 0.0; }
|
if (ctx._source.trending_score == null) { ctx._source.trending_score = 0.0; }
|
||||||
if ((-0.000001 <= ctx._source.trending_score) && (ctx._source.trending_score <= 0.000001)) {
|
if ((-0.1 <= ctx._source.trending_score) && (ctx._source.trending_score <= 0.1)) {
|
||||||
ctx._source.trending_score = 0.0;
|
ctx._source.trending_score = 0.0;
|
||||||
} else if (ctx._source.effective_amount >= %s) {
|
} else if (ctx._source.effective_amount >= %s) {
|
||||||
ctx._source.trending_score *= %s;
|
ctx._source.trending_score *= %s;
|
||||||
|
|
Loading…
Reference in a new issue