Lucy::Search::SortRule(3pm)

Lucy::Search::SortRule3pm

Element of a sortspec.

Usage

    my $sort_spec = Lucy::Search::SortSpec->new(
        rules => [
            Lucy::Search::SortRule->new( field => 'date' ),
            Lucy::Search::SortRule->new( type  => 'doc_id' ),
        ],
    );

Overview

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( [labeled params] )

    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,
    );
•

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()

Accessor for "field" member.

get_reverse()

Accessor for "reverse" member.

Inheritance

Lucy::Search::SortRule isa Lucy::Object::Obj.

Releases

2 releases since Debian 8 (Jessie); the text changed 1 time.

  1. 8
  2. 9

From liblucy-perl 0.3.3-7+b1 in Debian 9 (Stretch). Parsed by carta from the page's man source.