如何检索ThinkingSphinx搜索结果的相关值?

时间:2022-08-28 08:34:20

Is there any way to retrieve relevance values with results with the array returned by ThinkingSphinx? Percentages, points or whatever, just something I can work with?

有没有办法通过ThinkingSphinx返回的数组检索相关值?百分比,积分或其他什么,只是我可以使用的东西?

1 个解决方案

#1


2  

Yep - you can iterate over the result set, and retrieve the weight for each:

是的 - 您可以迭代结果集,并检索每个的权重:

results = ThinkingSphinx::Search.search(params[:q])
results.each_with_weighting do |result, weight|
  puts "#{result.name} #{weight}"
end

#1


2  

Yep - you can iterate over the result set, and retrieve the weight for each:

是的 - 您可以迭代结果集,并检索每个的权重:

results = ThinkingSphinx::Search.search(params[:q])
results.each_with_weighting do |result, weight|
  puts "#{result.name} #{weight}"
end