-
-
27 Feb 2018 08:40:23 UTC
- Distribution: Lucy
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Clone repository
- Issues
- Testers (1249 / 3 / 7)
- Kwalitee
Bus factor: 1- License: apache_2_0
- Perl: v5.8.3
- Activity
24 month- Tools
- Download (1.12MB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- The Apache Lucy Project <dev at lucy dot apache dot org>
- Dependencies
- Clownfish
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Lucy::Search::SortRule - Element of a SortSpec.
SYNOPSIS
my $sort_spec = Lucy::Search::SortSpec->new( rules => [ Lucy::Search::SortRule->new( field => 'date' ), Lucy::Search::SortRule->new( type => 'doc_id' ), ], );
DESCRIPTION
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.
CONSTRUCTORS
new
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.
type - Indicate whether to sort by score, field, etc. (The default is to sort by a field.)
field - The name of a
sortable
field.reverse - If true, reverse the order of the sort for this rule.
METHODS
get_field
my $string = $sort_rule->get_field();
Accessor for “field” member.
get_type
my $int = $sort_rule->get_type();
Accessor for “type” member.
get_reverse
my $bool = $sort_rule->get_reverse();
Accessor for “reverse” member.
INHERITANCE
Lucy::Search::SortRule isa Clownfish::Obj.
Module Install Instructions
To install Lucy, copy and paste the appropriate command in to your terminal.
cpanm Lucy
perl -MCPAN -e shell install Lucy
For more information on module installation, please visit the detailed CPAN module installation guide.