Lucy::Search::LeafQuery(3pm)

Lucy::Search::LeafQuery3pm

Leaf node in a tree created by queryparser.

Usage

    package MyQueryParser;
    use base qw( Lucy::Search::QueryParser );
    sub expand_leaf {
        my ( $self, $leaf_query ) = @_;
        if ( $leaf_query->get_text =~ /.\*\s*$/ ) {
            return PrefixQuery->new(
                query_string => $leaf_query->get_text,
                field        => $leaf_query->get_field,
            );
        }
        else {
            return $self->SUPER::expand_leaf($leaf_query);
        }
    }

Overview

LeafQuery objects serve as leaf nodes in the tree structure generated by QueryParser's tree() method. Ultimately, they must be transformed, typically into either TermQuery or PhraseQuery objects, as attempting to search a LeafQuery causes an error.

Constructors

new( [labeled params] )

    my $leaf_query = Lucy::Search::LeafQuery->new(
        text  => '"three blind mice"',    # required
        field => 'content',               # default: undef
    );
•

field - Optional field name.

•

text - Raw query text.

Methods

get_field()

Accessor for object's "field" attribute.

get_text()

Accessor for object's "text" attribute.

Inheritance

Lucy::Search::LeafQuery isa Lucy::Search::Query 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.