right.. i figure as much but thought would check. thanks for the quick 
reply!

On Saturday, March 16, 2013 10:52:59 PM UTC-4, Pat Allan wrote:
>
> Not with grouping… it returns one record per group value.
>
> If you want each record for each group, then I'd recommend just sorting by 
> the group value (in this case, locality_id). There's no each_with_* helper 
> for that, though, but the group_by enumerable method (not sure if it's Ruby 
> or Rails) should do the trick:
>
>   @result = @restaurant.search(
>     # …
>     :order => :locality_id
>   )
>   
>   @result.group_by(&:locality_id)
>
> Cheers
>
> -- 
> Pat
>
> On 17/03/2013, at 1:48 PM, Aditya Naik wrote:
>
> > aah.. that does it.. I was using v3,
> > 
> > It works now.. It returns only  restaurant per locality.. anyway to get 
> all restaurants?
> > 
> > On Saturday, March 16, 2013 10:43:36 PM UTC-4, Pat Allan wrote:
> > Are you using Thinking Sphinx v3? Try each_with_group instead.
> > And if not, which version of Thinking Sphinx are you using?
> > 
> > On 17/03/2013, at 1:39 PM, Aditya Naik wrote:
> > 
> > > Here is the code so far
> > > @restuarant = Restaurant.search(:with => {:city_id => @city.id})
> > > @result = @restuarant.search(
> > >           :conditions => {
> > >             :cuisines => "(#{params[:cuisine].split(/,/).join(") | 
> (")})",
> > >             :locality_name => "(#{params[:locality].split(/,/).join(") 
> | (")})"
> > >           },
> > >           :group_by => 'locality_id', 
> > >           :group_function => :attr
> > >         )
> > > 
> > > @result.each_with_groupby{ |r, g| [r,g]}
> > > 
> > > 
> > > When I do the last statement I get this.. 
> > > 
> > > NoMethodError: undefined method `each_with_groupby' for 
> #<Restaurant:0x007f9068da3680>
> > > 
> > > Any Ideas why?
> > > 
> > > I am trying to get to this
> > > 
> > > locality_id_1
> > >   restaurant_id_1
> > >   restaurant_id_2
> > >   restaurant_id_3
> > > locality_id_2
> > >   restaurant_id_4
> > >   restaurant_id_5
> > > 
> > > thanks in advance
> > > 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google 
> Groups "Thinking Sphinx" group.
> > > To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected].
> > > To post to this group, send email to [email protected].
> > > Visit this group at 
> http://groups.google.com/group/thinking-sphinx?hl=en.
> > > For more options, visit https://groups.google.com/groups/opt_out.
> > >  
> > >  
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Thinking Sphinx" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected] <javascript:>.
> > To post to this group, send email to 
> > [email protected]<javascript:>
> .
> > Visit this group at http://groups.google.com/group/thinking-sphinx?hl=en
> .
> > For more options, visit https://groups.google.com/groups/opt_out.
> >  
> >  
>
>
>
>

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


Reply via email to