—# ***********************************************
#
# !!!! DO NOT EDIT !!!!
#
# This file was auto-generated by Build.PL.
#
# ***********************************************
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
=encoding utf8
=head1 NAME
Lucy::Search::LeafQuery - Leaf node in a tree created by QueryParser.
=head1 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);
}
}
=head1 DESCRIPTION
LeafQuery objects serve as leaf nodes in the tree structure generated by
L<QueryParser|Lucy::Search::QueryParser>’s L<tree()|Lucy::Search::QueryParser/tree> method.
Ultimately, they must be transformed, typically into either
L<TermQuery|Lucy::Search::TermQuery> or
L<PhraseQuery|Lucy::Search::PhraseQuery> objects, as attempting to
search a LeafQuery causes an error.
=head1 CONSTRUCTORS
=head2 new
my $leaf_query = Lucy::Search::LeafQuery->new(
text => '"three blind mice"', # required
field => 'content', # default: undef
);
Create a new LeafQuery.
=over
=item *
B<field> - Optional field name.
=item *
B<text> - Raw query text.
=back
=head1 METHODS
=head2 get_field
my $retval = $leaf_query->get_field();
Accessor for object’s C<field> attribute.
=head2 get_text
my $retval = $leaf_query->get_text();
Accessor for object’s C<text> attribute.
=head2 make_compiler
my $retval = $leaf_query->make_compiler(
searcher => $searcher # required
boost => $boost # required
subordinate => $subordinate # default: false
);
Throws an error.
=head1 INHERITANCE
Lucy::Search::LeafQuery isa L<Lucy::Search::Query> isa Clownfish::Obj.
=cut