mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 07:52:19 +08:00
DEV: Add hidden site setting for PG search ranking normalization.
This commit is contained in:
parent
ecc799ab56
commit
af52df2d96
|
@ -1730,6 +1730,9 @@ backups:
|
||||||
hidden: true
|
hidden: true
|
||||||
|
|
||||||
search:
|
search:
|
||||||
|
search_ranking_normalization:
|
||||||
|
default: '1'
|
||||||
|
hidden: true
|
||||||
search_inject_extra_terms:
|
search_inject_extra_terms:
|
||||||
default: true
|
default: true
|
||||||
hidden: true
|
hidden: true
|
||||||
|
|
|
@ -937,14 +937,12 @@ class Search
|
||||||
posts = posts.order("posts.like_count DESC")
|
posts = posts.order("posts.like_count DESC")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# 1|32 divides the rank by 1 + logarithm of the document length and
|
|
||||||
# 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)},
|
||||||
1|32
|
#{Sitesetting.search_ranking_normalization}|32
|
||||||
) *
|
) *
|
||||||
(
|
(
|
||||||
CASE categories.search_priority
|
CASE categories.search_priority
|
||||||
|
|
Loading…
Reference in New Issue
Block a user