Search by ID, no keyword. Tried using :conditions but no result ouput.
- by Victor
Using Thinking Sphinx, Rails 2.3.8.
I don't have a keyword to search, but I wanna search by shop_id which is indexed. Here's my code:
@country = Country.search '', {
:with => {:shop_id => params[:shop_id]},
:group_by => 'trip_id',
:group_function => :attr,
:page => params[:page]
}
The one above works. But I thought the '' is rather redundant. So I replaced it with :conditions resulting as:
@country = Country.search :conditions => {
:with => {:shop_id => params[:shop_id]},
:group_by => 'trip_id',
:group_function => :attr,
:page => params[:page]
}
But then it gives 0 result. What is the correct code?
Thanks.