I've learned something.

This:

ret = Title.search("Batman", :ranker     => "expr(1)")


yields an error, but this


ret = Title.search("Batman", :ranker     => "expr('1')")


works.

Further experimentation shows that the entire expression needs to be quoted.

Two samples:

# use each item's id as its rank. Because we prefer high ranks over low, 
items are returned in
# order of descending id
#
ret = Title.search("Batman", :limit => 10000, :ranker     => 
"expr('id')").map(&:id)

# use the expression 1000-id as rank. Because we prefer high ranks over 
low, items are returned in
# order of ASCENDING id
ret = Title.search("Batman", :limit => 10000, :ranker     => "expr('10000 - 
id')").map(&:id)


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