【发布时间】:2021-02-23 20:37:56
【问题描述】:
我有 2 个文件:
{
title: "Popular",
registrations_count: 700,
is_featured: false
}
和
{
title: "Unpopular",
registrations_count: 100,
is_featured: true
}
我正在运行这个 Solr 查询(通过 Ruby Sunspot gem):
fq: ["type:Event"],
sort: "score desc",
q: "*:*",
defType: "edismax",
fl: "* score",
bq: ["registrations_count_i:[700 TO *]^10", "is_featured_bs:true^10"],
start: 0, rows: 30
或者,对于那些更习惯于 ruby 的人:
Challenge.search do
boost(10) do
with(:registrations_count).greater_than_or_equal_to(700)
end
boost(10) do
with(:is_featured, true)
end
order_by :score, :desc
end
一个文档匹配第一个 boost 查询,另一个匹配另一个 boost 查询。它们具有相同的提升值。
我的期望是两个文档都获得相同的分数。但他们没有,他们得到了类似的东西
1.2011336 # score for 'unpopular' (featured)
0.6366436 # score for 'popular' (not featured)
我还检查了如果我提升他们共同拥有的一个属性,他们会得到完全相同的分数,而且确实如此。我还尝试将700 的值更改为7000 之类的值,但这没有任何区别(这完全有道理)。
谁能解释为什么他们得到如此不同的分数,而他们都匹配一个提升查询?
【问题讨论】:
标签: sorting solr lucene sunspot