FIX: Avoid penalizing long documents too much in search.
This is a follow up to e87ca59401
.
This commit is contained in:
parent
5d6b6fe44e
commit
e8a4d72281
|
@ -836,14 +836,14 @@ class Search
|
||||||
posts = posts.order("posts.like_count DESC")
|
posts = posts.order("posts.like_count DESC")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# 2|32 divides the rank by the document length and scales the range from
|
# 1|32 divides the rank by 1 + logarithm of the document length and
|
||||||
# zero to one
|
# scales the range from zero to one
|
||||||
data_ranking = <<~SQL
|
data_ranking = <<~SQL
|
||||||
(
|
(
|
||||||
TS_RANK_CD(
|
TS_RANK_CD(
|
||||||
post_search_data.search_data,
|
post_search_data.search_data,
|
||||||
#{ts_query(weight_filter: weights)},
|
#{ts_query(weight_filter: weights)},
|
||||||
2|32
|
1|32
|
||||||
) *
|
) *
|
||||||
(
|
(
|
||||||
CASE categories.search_priority
|
CASE categories.search_priority
|
||||||
|
|
Loading…
Reference in New Issue