I’m not sure it *will* work, but try the following options in your search query:

  :rank_mode => :expr, :rank_expr => “1+2”

— 
Pat

> On 10 Dec 2014, at 6:49 pm, Terence Lin <[email protected]> wrote:
> 
> Hi Pat,
> 
> I'm still on TS 2.0.14, am I actually able to use rank_mode => "expr(1+2)" in 
> older version of TS?
> 
> Thanks,
> Terence
> 
> On Thursday, May 15, 2014 9:05:48 AM UTC-4, Pat Allan wrote:
> Hi Travis
> 
> You got pretty close - the :ranker option in a search call ends up in the 
> OPTION sections… so, :ranker => “expr(1+2)” will work.
> 
> Cheers
> 
> — 
> Pat
> 
> On 14 May 2014, at 10:18 am, Travis J I Corcoran <[email protected] 
> <javascript:>> wrote:
> 
>> 
>> I've been using TS for a while now.  Great product - thanks!
>> 
>> I'm getting complaints from our users that the ranking of results is not 
>> great.  OK - Sphinx allows  a lot of options.
>> 
>> I've figured out WeightEnumeratorMask and I've figured out how to use 
>> :ranker => SPH04 and that works decently...but there's so much more that can 
>> be done.  At least at the Sphinx level.
>> 
>> Reading the Sphinx docs here 
>> http://sphinxsearch.com/docs/current.html#ranking-factors 
>> <http://sphinxsearch.com/docs/current.html#ranking-factors>
>> I see that I might want to sort by, say 
>> 
>>     5 * weight() + sum(lcs) + 2 * wordcount() 
>> 
>> I've tried to specify :ranker => 'expr', but then I get the error
>> 
>> ThinkingSphinx::SphinxError: missing ranker expression (use OPTION 
>> ranker=expr('1+2') for example) - SELECT  *, sum(word_count) as custom  FROM 
>> `title_core` WHERE MATCH('Batman') AND `sphinx_deleted` = 0 ORDER BY 
>> `custom` DESC LIMIT 0, 20 OPTION ranker=expr; SHOW META
>> 
>> where do I put this 
>> 
>> OPTION ranker=expr('1+2')
>> 
>> ?
>> 
>> It doesn't go in the :select argument, because if I try that I get an error.
>> 
>> tl;dr can someone supply an example that uses        SPH_RANK_EXPR and a 
>> moderately complex custom ranking algorithm?
>> 
>> Many  thanks!
>> 
>> 
>> Travis
>> 
>> -- 
>> 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 
>> <http://groups.google.com/group/thinking-sphinx>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
> 
> 
> IMPORTANT NOTICE:  This message, including any attachments (hereinafter 
> collectively referred to as "Communication"), is intended only for the 
> addressee(s) named above.  This Communication may include information that is 
> privileged, confidential and exempt from disclosure under applicable law.  If 
> the recipient of this Communication is not the intended recipient, or the 
> employee or agent responsible for delivering this Communication to the 
> intended recipient, you are notified that any dissemination, distribution or 
> copying of this Communication is strictly prohibited.  If you have received 
> this Communication in error, please notify the sender immediately by phone or 
> email and permanently delete this Communication from your computer without 
> making a copy. Thank you.
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/thinking-sphinx 
> <http://groups.google.com/group/thinking-sphinx>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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/d/optout.

Reply via email to