You can get the weight/rank via each_with_weighting:
results = Model.search 'foo'
results.each_with_weighting do |result, weight|
# ...
end
Keep in mind there's no upper limit on weight values - just that the higher it
is, the better the match, according to Sphinx. And your basic match modes (all,
any) don't do anything much in the way of weighting - in most cases, you'll
just see the default weight of 1. The extended or extended2 match modes are
your best bet.
Cheers
--
Pat
On 07/07/2011, at 9:22 PM, sergiu wrote:
> Hi there,
>
> I already use sphinx and thinking sphinx for searching. I need to add
> a new feature, which is knowing that for example if I search for "ruby
> on rails", I want to know the rank for each returned result. Can I
> access the sphinx internal @rank attribute in any way? because I think
> that's exactly what I'm looking for.
>
> Again: I want to know for each of my search results, that they rank
> for example 100 out of 1000. Any other suggestions are appreciated.
> Thank you!
>
> Sergiu
>
> --
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/thinking-sphinx?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.