KinoSearch::Search::LeafQuery - Leaf node in a tree created by QueryParser.
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); } }
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 = KinoSearch::Search::LeafQuery->new( text => '"three blind mice"', # required field => 'content', # default: undef );
field - Optional field name.
text - Raw query text.
Accessor for object's field attribute.
field
Accessor for object's text attribute.
text
KinoSearch::Search::LeafQuery isa KinoSearch::Search::Query isa KinoSearch::Object::Obj.
Copyright 2005-2011 Marvin Humphrey
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install KSx::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm KSx::Simple
CPAN shell
perl -MCPAN -e shell install KSx::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.