views:

679

answers:

2

I'm using the sphinx search engine with the thinking sphinx plugin for rails.

I have a job model with a title attribute that is indexed by sphinx. I'd like to search across multiple jobs and capture any that match 1 or more keywords.

For instance...

Job.search("rails, django, symfony")

...and get an array of job objects with the following titles "rails developer for hire", "looking for a django wizard", "anyone know symfony?"

I have these three separate jobs stored and indexed in my database. When I run the above search i get an empty array. Each job is found when a single query term is provided on its own.

I would rather not do this Job.search "rails" Job.search "django" Job.search "symfony"

Does anyone know how to pass multiple keywords to the sphinx search engine?

+6  A: 
Job.search("rails | django | symfony", :match_mode => :extended)
danpickett
A: 

Thanks for the Reply.

But I want a first result which match more words together in top result. Like, if a result have "Rails Symfony" it should be in top result. How we can achieve that?

Thanks IM-RM

IM RM
-1 Please don't use "answers" for asking questions.
klew