You could add a "virtual attribute" to tell if the user is located to the index.
define_index do
has "lat IS NOT NULL AND lng IS NOT NULL", :as => :located
end
And then use this in the with-clause:
User.search(:with => { :located => true })
Or – if you don't need "unlocated" users at all – add a where clause to the
index to not have them indexed:
define_index do
where "lat IS NOT NULL AND lng IS NOT NULL"
end
Hope that helps,
- C.
Clemens Kofler
http://www.railway.at
[email protected]
railway - welcome aboard!
On Mar 7, 2011, at 4:33 PM, rtacconi wrote:
> With the following search
>
> User.search(params[:search], :conditions => conditions,
> :with => with,
> :without => {:lat =>
> nil, :lng => nil},
> :sort_mode => :extended,
> :order => "created_at
> DESC, updated_at DESC",
> :max_matches => 1000,
> :per_page => 1000)
>
> I get an error:
>
> No response from searchd (status: , version: )
>
> I changed the :without clause with:
>
> :without => {:lat => nil, :lng => nil}
>
> But I do not get any result. I need to exclude user with lat and lng
> attibutes set to nil or 0.0. Any idea?
>
> --
> 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.