Lucy::Search::SortRule - Element of a SortSpec.
my $sort_spec = Lucy::Search::SortSpec->new( rules => [ Lucy::Search::SortRule->new( field => 'date' ), Lucy::Search::SortRule->new( type => 'doc_id' ), ], );
SortRules are the building blocks used to assemble SortSpecs; each SortRule defines a single level of sorting. For example, sorting first by “category” then by score requires a SortSpec with two SortRule elements.
my $by_title = Lucy::Search::SortRule->new( field => 'title' ); my $by_score = Lucy::Search::SortRule->new( type => 'score' ); my $by_doc_id = Lucy::Search::SortRule->new( type => 'doc_id' ); my $reverse_date = Lucy::Search::SortRule->new( field => 'date', reverse => 1, );
Create a new SortRule.
sortable
field.my $string = $sort_rule->get_field();
Accessor for “field” member.
my $int = $sort_rule->get_type();
Accessor for “type” member.
my $bool = $sort_rule->get_reverse();
Accessor for “reverse” member.
Lucy::Search::SortRule isa Clownfish::Obj.
Copyright © 2010-2015 The Apache Software Foundation, Licensed under the
Apache License, Version 2.0.
Apache Lucy, Lucy, Apache, the Apache feather logo, and the Apache Lucy project logo are trademarks of The
Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their
respective owners.