Hi Tiago

To be honest, I'm a little surprised that Sphinx doesn't do this automatically 
- it's an issue that's cropped up here a few times.

I came across this thread on the Sphinx forum which discusses the issue:
http://sphinxsearch.com/forum/view.html?id=1923

It seems the solution - which is a little hacky - is to repeat the given query 
a few times. So, for example let's say the search term is in params[:query]:

  City.search "\"^#{params[:query]}$\" | \"#{params[:query]}\" | 
(#{params[:query]})"

With Thinking Sphinx v3, the default (and indeed, only) match mode is extended, 
but if you're using TS v1/v2, you'll need to set that yourself with :match_mode 
=> :extended. That forum thread also suggests using the wordcount ranker, which 
is set with :ranker in TS v3, :rank_mode in TS v1/v2, set to :wordcount.

Give that a spin, let us know how it goes.

-- 
Pat

On 25/05/2013, at 2:54 AM, Tiago wrote:

> Hello,
> 
> Sphinx/ThinkingSphinx is working great for me, but I'm having a lot of 
> trouble to make it rank the records correctly.
> 
> In my case I've a cities table, and I'm trying to match them by the name.
> What happens is apparently it gives more relevance to composed words than 
> proper perfect matches.
> 
> For example:
> 
> searching for "london"
> 
> brings on top cities like "London Cloney", "London .." and so on.
> I would still like them to be fetched, but I would like that exact matches 
> have better relevance.
> 
> I tried a diverse combination of match/rank modes, but no success.
> Can someone please point me what would be the recommended approach?
> 
> Extra information: I'm using it with sinatra and active record.
> 
> Thank you!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

 

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to