Lucy::Search::LeafQuery - Leaf node in a tree created by QueryParser.
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); } }
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.
my $leaf_query = Lucy::Search::LeafQuery->new( text => '"three blind mice"', # required field => 'content', # default: undef );
Create a new LeafQuery.
my $string = $leaf_query->get_field();
Accessor for object’s field
attribute.
my $string = $leaf_query->get_text();
Accessor for object’s text
attribute.
my $compiler = $leaf_query->make_compiler( searcher => $searcher # required boost => $boost # required subordinate => $subordinate # default: false );
Throws an error.
Lucy::Search::LeafQuery isa Lucy::Search::Query isa Clownfish::Obj.
Copyright © 2010-2015 The Apache Software Foundation, Licensed under the
Apache License, Version 2.0.
Apache Lucy, Lucy, Apache, the Apache feather logo, and the Apache Lucy project logo are trademarks of The
Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their
respective owners.