Hello,
I'm trying to use Thinking Sphinx on a Ruby project to order search results.
I'm using the advanced search expression functionality, however it's not
behaving as expected.
I'm basically doing the following:
search_options = {:sort_mode => :expr, :order => "IF(val1, val1, val2)"}
My goal is to order this by val1 if val1 is present, otherwise order by val2.
When I execute this, I see things that have a val1 of -1 getting put before
things that have a positive val2 value.
Here's an example search result:
val2: [3, 999, 190, 13, 9, 6, 6, 4, 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 2]
val1: [-1, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil]
I'm seeing the object with a val1 of -1 coming first, then the object with a
val2 of 999, then 190, then 13, etc.
So, is there a reason why Thinking Sphinx is forcing the object with a val1 of
-1 to the top? Is there an easy way to fix this?
Thanks!
Ryan
--
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/-/_8DSj-CL-KQJ.
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.