mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Fix negatives values in search index causing queries to fail (#19464)
This commit is contained in:
parent
bf0ab3e0fa
commit
7d25f72b9f
@ -105,7 +105,7 @@ class AccountSearchService < BaseService
|
|||||||
{
|
{
|
||||||
script_score: {
|
script_score: {
|
||||||
script: {
|
script: {
|
||||||
source: "(doc['followers_count'].value + 0.0) / (doc['followers_count'].value + doc['following_count'].value + 1)",
|
source: "(Math.max(doc['followers_count'].value, 0) + 0.0) / (Math.max(doc['followers_count'].value, 0) + Math.max(doc['following_count'].value, 0) + 1)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -113,10 +113,10 @@ class AccountSearchService < BaseService
|
|||||||
|
|
||||||
def followers_score_function
|
def followers_score_function
|
||||||
{
|
{
|
||||||
field_value_factor: {
|
script_score: {
|
||||||
field: 'followers_count',
|
script: {
|
||||||
modifier: 'log2p',
|
source: "log2p(Math.max(doc['followers_count'].value, 0))",
|
||||||
missing: 0,
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user