When you're referring to an internal Sphinx attribute, you use the @ - but any 
of your own, you don't. So, try the following:

  :order => "@weight DESC, vintage_year DESC"

On 18/01/2013, at 2:20 AM, Ahmed El-Daly wrote:

> Oh, and I'm searching by sql, because this doesn't seem to work:
> 
> order: '@weight DESC, @vintage_year DESC',
> 
> It gives me: Mysql2::Error: sphinxql: syntax error, unexpected USERVAR, 
> expecting IDENT (or 4 other tokens) near '@vintage_year DESC LIMIT 0, 10; 
> SHOW META'
> 
> in my wine_index.rb, I have:
> indexes vintage_year
> 
> Is the syntax correct for what I want to do?
> 
> Thanks again.
> 
> ---------------------------------------------------------
> Ahmed El-Daly Chief Guru 
> DeveloperGurus Inc.  on budget, on time
> T: 416-566-4945  |  developergurus.com
> 
> On 2013-01-17, at 9:05 AM, "Pat Allan" <[email protected]> wrote:
> 
>> That error doesn't seem to quite match the query - are you sorting by @rank 
>> or custom_rank? Or does the error occur either way? Perhaps SphinxQL doesn't 
>> understand @rank - but it should be fine with @weight, which is the same 
>> thing.
>> 
>> That said - you're also sorting with the SQL statement - why bother with the 
>> Sphinx sort order at all?
>> 
>> (And that SQL ordering should be done like so in v3: :sql => {:order => 
>> 'vintage_year DESC'} )
>> 
>> Cheers
>> 
>> -- 
>> Pat
>> 
>> On 17/01/2013, at 2:38 AM, Daly wrote:
>> 
>>> Good morning,
>>> 
>>> This used to work fine:
>>> options = {:retry_stale => true, :sort_mode => :extended, :order => '@rank 
>>> DESC', :per_page => 1000000, :sql_order => 'vintage_year DESC'}
>>> options.merge!(:per_page => 10, :page => page) if use_pagination
>>> results = Wine.search(string, options)
>>> 
>>> After the upgrade, it complains with:
>>> Mysql2::Error: sphinxql: syntax error, unexpected USERVAR, expecting IDENT 
>>> (or 5 other tokens) near '@rank DESC LIMIT 0, 10; SHOW META'
>>> 
>>> I tried this:
>>>      options = {
>>>        :retry_stale => true,
>>>        :sort_mode => :extended,
>>>        :select => '*, @rank as custom_rank',
>>>        :order => :custom_rank,
>>>        :per_page => 1000000,
>>>        :sql_order => 'vintage_year DESC'
>>>      }
>>> 
>>> and that produces:
>>> Mysql2::Error: index wine_core: parse error: Sphinx expr: syntax error, 
>>> unexpected TOK_USERVAR near '@rank'
>>> 
>>> What's the proper way of specifying this in the new version?
>>> 
>>> Thanks.
>>> 
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "Thinking Sphinx" group.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msg/thinking-sphinx/-/8rDDG7z8mP0J.
>>> 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.
>> 
> 
> 
> -- 
> 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.

Reply via email to