1Lucy::Search::SortRule(U3s)er Contributed Perl DocumentatLiuocny::Search::SortRule(3)
2
3
4

NAME

6       Lucy::Search::SortRule - Element of a SortSpec.
7

SYNOPSIS

9           my $sort_spec = Lucy::Search::SortSpec->new(
10               rules => [
11                   Lucy::Search::SortRule->new( field => 'date' ),
12                   Lucy::Search::SortRule->new( type  => 'doc_id' ),
13               ],
14           );
15

DESCRIPTION

17       SortRules are the building blocks used to assemble SortSpecs; each
18       SortRule defines a single level of sorting.  For example, sorting first
19       by XcategoryX then by score requires a SortSpec with two SortRule
20       elements.
21

CONSTRUCTORS

23   new
24           my $by_title   = Lucy::Search::SortRule->new( field => 'title' );
25           my $by_score   = Lucy::Search::SortRule->new( type  => 'score' );
26           my $by_doc_id  = Lucy::Search::SortRule->new( type  => 'doc_id' );
27           my $reverse_date = Lucy::Search::SortRule->new(
28               field   => 'date',
29               reverse => 1,
30           );
31
32       Create a new SortRule.
33
34       ·   type - Indicate whether to sort by score, field, etc.  (The default
35           is to sort by a field.)
36
37       ·   field - The name of a "sortable" field.
38
39       ·   reverse - If true, reverse the order of the sort for this rule.
40

METHODS

42   get_field
43           my $string = $sort_rule->get_field();
44
45       Accessor for XfieldX member.
46
47   get_type
48           my $int = $sort_rule->get_type();
49
50       Accessor for XtypeX member.
51
52   get_reverse
53           my $bool = $sort_rule->get_reverse();
54
55       Accessor for XreverseX member.
56

INHERITANCE

58       Lucy::Search::SortRule isa Clownfish::Obj.
59
60
61
62perl v5.32.0                      2020-07-28         Lucy::Search::SortRule(3)
Impressum