1Lucy::Search::SortSpec(U3s)er Contributed Perl DocumentatLiuocny::Search::SortSpec(3)
2
3
4
6 Lucy::Search::SortSpec - Specify a custom sort order for search
7 results.
8
10 my $sort_spec = Lucy::Search::SortSpec->new(
11 rules => [
12 Lucy::Search::SortRule->new( field => 'date' ),
13 Lucy::Search::SortRule->new( type => 'doc_id' ),
14 ],
15 );
16 my $hits = $searcher->hits(
17 query => $query,
18 sort_spec => $sort_spec,
19 );
20
22 By default, searches return results in order of relevance; SortSpec
23 allows you to indicate an alternate order via an array of SortRules.
24
25 Fields you wish to sort against must be "sortable".
26
27 For a stable sort (important when paging through results), add a sort-
28 by-doc rule as the last SortRule.
29
31 new
32 my $sort_spec = Lucy::Search::SortSpec->new( rules => \@rules );
33
34 Create a new SortSpec.
35
36 • rules - An array of SortRules.
37
39 Lucy::Search::SortSpec isa Clownfish::Obj.
40
41
42
43perl v5.36.0 2023-01-20 Lucy::Search::SortSpec(3)