Kevin
Kevin

Reputation: 1614

Rails Thinking Sphinx All Results

I'm not sure if accomplishing problem is impossible, so help me out. If running a search like this

@things = Thing.search params[:search]

for 'jack' returns all results with relevance 'jack'. and 'sushi' returns all results with relevance 'sushi'. But if i type 'jack sushi' i get only results with both relevance 'jack' and 'sushi'. What if i want all results with either relevance but most relevance higher in my results. (so i if i typed in 'jack sushi' then if something relates to 'jack' but not 'sushi' i still get it as a result)

Upvotes: 0

Views: 219

Answers (1)

Hiltmon
Hiltmon

Reputation: 1265

Try a different match_mode. You could use :any which matches any of the words you type in, or :boolean and search for "jack or sushi".

Example

@things = Thing.search params[:search], :match_mode => :any

Hope this helps.

Upvotes: 2

Related Questions