Nick Wellnhofer > Lucy > Lucy::Search::LeafQuery

Download:
Lucy-0.5.1.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.005001   Source  

NAME ^

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

SYNOPSIS ^

    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);
        }
    }

DESCRIPTION ^

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

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

Create a new LeafQuery.

METHODS ^

get_field

    my $string = $leaf_query->get_field();

Accessor for object’s field attribute.

get_text

    my $string = $leaf_query->get_text();

Accessor for object’s text attribute.

make_compiler

    my $compiler = $leaf_query->make_compiler(
        searcher    => $searcher     # required
        boost       => $boost        # required
        subordinate => $subordinate  # default: false
    );

Throws an error.

INHERITANCE ^

Lucy::Search::LeafQuery isa Lucy::Search::Query isa Clownfish::Obj.

syntax highlighting: