The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lucy::Search::TermQuery - Query which matches individual terms.

SYNOPSIS

    my $term_query = Lucy::Search::TermQuery->new(
        field => 'content',
        term  => 'foo', 
    );
    my $hits = $searcher->hits( query => $term_query );

DESCRIPTION

TermQuery is a subclass of Query for matching individual terms in a specific field.

CONSTRUCTORS

new

    my $term_query = Lucy::Search::TermQuery->new(
        field => 'content',    # required
        term  => 'foo',        # required
    );

Create a new TermQuery.

  • field - Field name.

  • term - Term text.

METHODS

get_field

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

Accessor for object’s field member.

get_term

    my $obj = $term_query->get_term();

Accessor for object’s term member.

make_compiler

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

Abstract factory method returning a Compiler derived from this Query.

  • searcher - A Searcher.

  • boost - A scoring multiplier.

  • subordinate - Indicates whether the Query is a subquery (as opposed to a top-level query). If false, the implementation must invoke normalize() on the newly minted Compiler object before returning it.

INHERITANCE

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