How do I retrieve relevance value for ThinkingSphinx search results?
-
05-07-2019 - |
Question
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?
Solution
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow