Hi,

I'm migrating an app using TS 1.4.13 with rails 2 to a new one using TS 3 
with rails 4.

The model name is Tagging, and it has a string attribute 'normalized'. I 
want to group by this 'normalized' attribute, and sort according to the 
number of coincidences.

The index is:

----------
define_index do
    indexes normalized, :sorted => true
    has "CRC32(normalized)", :as => :normalized_copy, :type => :integer
end
---------

In the old application the code for doing this was:

Tagging.search( nil, :group_by => 'normalized_copy', :group_function => 
:attr, :group_clause => "@count desc", :per_page => 50, :page => page )

In the new application I'm doing this:

Tagging.search( nil, :group_by => :normalized_copy, :order_group_by => 
"@count desc", :per_page => 50, :page => page )


A normal sql query shows that the most use tags and their respective counts 
are the following:
["vintage", 8351]
["furniture", 3882]
["mid century", 3691]
["modern", 1955]
["jewelry", 1746]


The old code (TS 1.4.13 and rails 2.3.18) works great, this is what it 
returns:

vintage  8351
furniture  3882
mid century  3691
modern  1955
jewelry  1746

But with the new code (TS 3.0.5 and rails 4), sort is not working.

adopter  1
gateaux  1
gouter  1
chaine  2
the boss  1

This is the sphinx console log:

Sphinx Query (248.8ms)  SELECT *, *, @groupby, @count FROM `tagging_core` 
WHERE `sphinx_deleted` = 0 GROUP BY `normalized_copy` WITHIN GROUP ORDER BY 
@count desc LIMIT 0, 20 OPTION max_matches=250000
Sphinx  Found 25713 results

Apparently it's throwing the 'sort by @count', but it's not working, or 
maybe I'm missing something? Is this a known bug?

Thank you.
Fernando.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to