seanbehan
seanbehan

Reputation: 1601

Multiple Keyword Search Using Thinking Sphinx Rails Plugin

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?

Upvotes: 0

Views: 1693

Answers (1)

danpickett
danpickett

Reputation: 2046

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

Upvotes: 6

Related Questions