KinoSearch::Search::LeafQuery - Leaf node in a tree created by QueryParser.


KinoSearch documentation  | view source Contained in the KinoSearch distribution.

Index


NAME

Top

KinoSearch::Search::LeafQuery - Leaf node in a tree created by QueryParser.

SYNOPSIS

Top

    package MyQueryParser;
    use base qw( KinoSearch::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);
        }
    }







DESCRIPTION

Top

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

Top

new( [labeled params] )

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

METHODS

Top

get_field()

Accessor for object's field attribute.

get_text()

Accessor for object's text attribute.

INHERITANCE

Top

KinoSearch::Search::LeafQuery isa KinoSearch::Search::Query isa KinoSearch::Object::Obj.

COPYRIGHT AND LICENSE

Top


KinoSearch documentation  | view source Contained in the KinoSearch distribution.