Here is the index snippet:
doc = Ferret::Document::Document.new
# insert the id
doc << Ferret::Document::Field.new( "id", post.id,
Ferret::Document::Field::Store::YES,
Ferret::Document::Field::Index::UNTOKENIZED )
# insert the date
doc << Ferret::Document::Field.new( "created_at", post.created_at,
Ferret::Document::Field::Store::NO,
Ferret::Document::Field::Index::UNTOKENIZED )
# add some other stuff ...
# write to the index
index << doc
Here is the query snippet:
sort_fields = []
sort_fields << Ferret::Search::SortField.new
( "created_at", :sort_type =>
Ferret::Search::SortField::SortType::INTEGER, :reverse => true )
# search the index
top_docs = index.search( query, { :first_doc =>
first_doc , :num_docs => 5, :sort => sort_fields } )
On Jul 12, 2006, at 4:57 PM, David Balmain wrote:
> On 7/13/06, Floyd Morgan <[EMAIL PROTECTED]> wrote:
>> I am getting strange results when I reverse sort a query. I am
>> sorting
>> by date, but it doesn't seem to be related to dates (I have tried
>> just
>> integers). I also paginate the results. Items in the result set are
>> sometimes duplicated and the not ordered at all. When I try a
>> non-reverse sort I don't see duplicates and the ordering is
>> correct. Any
>> ideas what is going on? Thanks
>
> No idea. Could you show us some example code. Preferably with a
> short test case.
>
> Cheers,
> Dave
> _______________________________________________
> Ferret-talk mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ferret-talk
>
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk