Problem solved!!!

We had to change the index to the following:

  define_index do
    indexes :description

    has :price_in_cents, :type => :integer
    has "LOWER(products.name)", :type => :string, :as => :name
    has :equivalent_products_group_id

    set_property :delta => true
  end

and apparently TS is not happy if you don't specify a direction in the
group_clause, such as 'ASC':

Product.search("drill", :group_by =>
"equivalent_products_group_id", :group_function
=> :attr, :group_clause => "name ASC", :sort => :price_in_cents)

Thanks for listening :)
Tom


On Feb 24, 1:17 pm, Tom <[email protected]> wrote:
> Hi again.
>
> Small update:
>
> When running a comparable query with the search script it works
> perfectly... here's the command
>
> search -c config/development.sphinx.conf -g
> "equivalent_products_group_id" -gs "name ASC" -s "price_in_cents ASC"
> drill
>
> Cheers,
> Tom
>
> On Feb 24, 11:45 am, Tom <[email protected]> wrote:
>
>
>
> > G'Day.
>
> > I have a problem when trying to group my results...
>
> > Here's (the important part of) my define_index block:
>
> >   define_index do
> >     indexes :name, :sortable => true
> >     indexes :price_in_cents, :sortable => true
>
> >     has :equivalent_products_group_id
>
> >     set_property :delta => true
> >   end
>
> > Now, when i do a query like this
>
> > Product.search(:order => :price_in_cents, :group_by =>
> > "equivalent_products_group_id", :group_function => :attr)
>
> > it returns the correct results. But as soon as i specify a
> > group_clause option, like this
>
> > Product.search(:order => :price_in_cents, :group_by =>
> > "equivalent_products_group_id", :group_function
> > => :attr, :group_clause => "name")
>
> > it returns an empty result set. The only time the group clause option
> > seems to work, is when i use it with "@group" or "@count". I played
> > around with the index (changing fields to attributes, ...) - without
> > success.
>
> > Help would be highly appreciated! Thanks
> > Tom

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