Reading twice what I've written to fast the search query should have
been

ruby-1.9.2-p0 > Organization.search(:conditions => {:loc => "1/17715/
*"}, :match_mode => :phrase)
 => []

Which is not working


On 26 août, 18:24, keldelice <[email protected]> wrote:
> Hi,
>
> Let's says that I've Organizations that belongs to a Location (always
> a City).
>
> Location is using ancestry gem in order to create a nested set like
> Country > Region > County > City
> The nested set path is store in a column named "ancestry" (String)
> like "1/2/3" each / representing the parent_id
>
> What I'd like to do is to find all organizations within a Region or a
> County
>
> So in Organization model I have
>
>   define_index do
>     indexes title, :sortable => true
>     indexes location(:ancestry), :as => :loc
>
>   end
>
> However
>
> ruby-1.9.2-p0 > Location.search(:conditions => {:ancestry => "1/17715/
> *"}, :match_mode => :phrase)
>  => []
>
> but
>
> ruby-1.9.2-p0 > Organization.where("locations.ancestry LIKE
> '1/17715/%'").includes(:location).count
>  => 401
>
> I've   enable_star: true in sphinx.yml
>
> Is there someone who has a better solution ? (Or an idea of what I've
> missed :)
>
> Thanks
> Cyrille

-- 
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