ruby on rails - Conditional "or" in Thinking Sphinx search -


using ror 2.3.8.

here's controller code:

class citiescontroller < applicationcontroller   def show     @city = city.find(params[:id])     @shops = shop.search @city.name, {       :conditions => {:country => @city.country && (:city => @city.name || :state => @city.state)},       :page => params[:page],       :per_page => 100       }   end end 

the :conditions => {:country => @city.country && (:city => @city.name || :state => @city.state)} doesn't work because trying explain wanna achieve.

:city , :state columns spots table, not cities table. want results return either 1 of them fulfills condition. have no clue how it.

thanks.

tass has got right - ts search call, should this:

def show   @city = city.find(params[:id])   @shops = shop.search "#{@city.name} @country #{@city.country} (@city #{@city.name} | @state #{@city.state})",     :match_mode => :extended,     :page       => params[:page],     :per_page   => 100     } end 

you'll note i've set match mode - thinking sphinx automatically if you're using :conditions argument - when constructing query manually, need set yourself.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -