pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 468 forks source link

SPH_RANK_SPH04 ranker #319

Closed janko closed 12 years ago

janko commented 12 years ago

First, I have to say that your gem is awesome. I really enjoy using it.

While choosing how to search, I wanted to choose a way that will rank exact matches higher than other. I found out on Sphinx's page that the ranker SPH_RANK_SPH04 does exactly that. So, is there any chance you can add it? Because I'm sure that many other people would enjoy it too.

pat commented 12 years ago

Hi Janko

Great to hear Thinking Sphinx is working well for you. You can choose other rankers via the :rank_mode option:

Model.search 'foo', :rank_mode => :sph04

Cheers

janko commented 12 years ago

But you don't have it in the code. Isn't it supposed to be in vendor/riddle/lib/riddle/client.rb? Because it's not listed under RankModes.

I was checking in the code because it doesn't work for me.

pat commented 12 years ago

Ah, you may need to update Thinking Sphinx - what version are you using?

janko commented 12 years ago

2.0.10

pat commented 12 years ago

If you're using TS as a gem (and that's certainly what I recommend), riddle is referenced as a gem as well (v1.5.0), and will have that rank mode in it.

On 18/12/2011, at 12:51 PM, Janko Marohnić wrote:

2.0.10


Reply to this email directly or view it on GitHub: https://github.com/freelancing-god/thinking-sphinx/issues/319#issuecomment-3192728

janko commented 12 years ago

I guess I saw something wrong. I went into my riddle gem folder now, and I saw that there was :sph04. Sorry, I probably did something wrong in the code, causing the ranking not to work. Can I ask you something then? Can I do something like this?

:sort_mode => :sph04, :order => "@relevance DESC, popularity DESC"

I know it won't work, because you said in the guide that passing string to :order key is only possible with :sort_mode => :extended. But is it still somehow possible to do the above?

pat commented 12 years ago

:sort_mode and :rank_mode are separate settings - so just use the following:

:rank_mode => :sph04, :order => '@relevance DESC, popularity DESC'

On 18/12/2011, at 1:06 PM, Janko Marohnić wrote:

I guess I saw something wrong. I went into my riddle gem folder now, and I saw that there was :sph04. Sorry, I probably did something wrong in the code. Can I ask you something then? Can I do something like this?

:sort_mode => :sph04, :order => "@relevance DESC, popularity DESC"

I know it won't work, because you said in the guide that passing string to :order key is only possible with :sort_mode => :extended. But is it still somehow possible to do the above?


Reply to this email directly or view it on GitHub: https://github.com/freelancing-god/thinking-sphinx/issues/319#issuecomment-3192774

janko commented 12 years ago

Oh tnx, I mixed them up. Unfortunately, it still doesn't match exact results higher, but now I know you don't have anything to do with this. Thank you for your help :)

pat commented 12 years ago

No worries - good luck with getting it sorting better :)

thoughtpunch commented 11 years ago

Is it possible setting the rank_mode globally in the thinking_sphinx.yml file?

pat commented 11 years ago

With Thinking Sphinx v3, the option is ranker, but yes, you should be able to set a default value for it in thinking_sphinx.yml under each environment.