Also: what does your define_index block look like?

-- 
Pat

On 29/06/2011, at 11:04 PM, Pat Allan wrote:

> Hi Swapnil
> 
> Firstly - if you're mixing a normal query, attributes, and query conditions, 
> then they should work in an AND fashion.
> 
> But there's a slight bug in the code you've provided - I think you want:
> cities = params[:city].blank? ? {} : {:city => params[:city]}
> 
> If you give that a shot, does it return the expected results?
> 
> -- 
> Pat
> 
> On 29/06/2011, at 5:03 PM, Swapnil Chincholkar wrote:
> 
>> I am new to ROR world and using TS.
>> I have a user model and location model with user has many locations as
>> relation.
>> Location has country_id as a field in it.
>> params has a string name and country id.
>> 
>> i want to find
>> user whose name like params[:name] and country_id as
>> params[:country_id].
>> 
>> I m doing this,
>> cs = {}
>> cs = cs.merge(:country_id => params[:country_id) unless
>> params[:country_id].blank?
>> cities = params[:city].blank? ? {} : params[:city]
>> User.search(params[:name], :with => cs, :conditions => cities, :star
>> => true, :order => "name ASC", :retry_stale => true)
>> 
>> If i send params[:name} as "or" and country as existing one I do get
>> result containing few correct and
>> few User's with name not similar to *or* but with country as entered.
>> i.e it is OR'ing the conditions, name or country
>> I want name AND country both to be matched.
>> 
>> What to do with this?
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Thinking Sphinx" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/thinking-sphinx?hl=en.
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/thinking-sphinx?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to