FIX: Avoid penalizing long documents too much in search.

This is a follow up to e87ca59401.
This commit is contained in:
Guo Xiang Tan 2019-04-03 14:05:50 +08:00
parent 5d6b6fe44e
commit e8a4d72281
1 changed files with 3 additions and 3 deletions

View File

@ -836,14 +836,14 @@ class Search
posts = posts.order("posts.like_count DESC")
end
else
# 2|32 divides the rank by the document length and scales the range from
# zero to one
# 1|32 divides the rank by 1 + logarithm of the document length and
# scales the range from zero to one
data_ranking = <<~SQL
(
TS_RANK_CD(
post_search_data.search_data,
#{ts_query(weight_filter: weights)},
2|32
1|32
) *
(
CASE categories.search_priority