Sort order not working on Linux

Hello,

I’m seeing a really strange behavior with Ferret sorting. I have an
application that uses acts_as_ferret to index and search documents. On
Windows or Mac, using ferret to sort works for both ascending and
descending but when I move the app to Linux it breaks and will only sort
in ascending order no matter what I pass into the options[:sort] field.
I’ve tried using a SortField object and using a string definition. For
example this test passes on Windows and Mac but fails on any Linux
machine I run it on:

def test_reverse_sorting
sort = Ferret::Search::SortField.new(:updated_at_int, :type =>
:integer, :reverse => false)
sort_rev = Ferret::Search::SortField.new(:updated_at_int, :type =>
:integer, :reverse => true)
a = ContentTranslation.query(“class_name:ArticleTranslation”, :sort
=> sort).first.first
b = ContentTranslation.query(“class_name:ArticleTranslation”, :sort
=> sort_rev).first.first
assert_not_equal a.title, b.title
assert_not_equal a[:id], b[:id]
end

It fails even if I use “updated_at_int” and “updated_at_int DESC”
instead of a SortField object.

I’ve checked that the versions of ruby, rails and ferret are all the
same on the various platforms. Any other advice or help would be
greatly appreciated. Thanks.

EJ Finneran
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs