Lucy

 view release on metacpan or  search on metacpan

lib/Lucy/Search/Compiler.pod  view on Meta::CPAN


Returns: a Matcher, or undef if the Matcher would have matched
no documents.

=head1 METHODS

=head2 get_weight

    my $float = $compiler->get_weight();

Return the Compiler’s numerical weight, a scoring multiplier.  By
default, returns the object’s boost.

=head2 get_similarity

    my $similarity = $compiler->get_similarity();

Accessor for the Compiler’s Similarity object.

=head2 get_parent

    my $query = $compiler->get_parent();

Accessor for the Compiler’s parent Query object.

=head2 sum_of_squared_weights

    my $float = $compiler->sum_of_squared_weights();

Compute and return a raw weighting factor.  (This quantity is used by
L<normalize()|/normalize>).  By default, simply returns 1.0.

=head2 apply_norm_factor

    $compiler->apply_norm_factor($factor);

Apply a floating point normalization multiplier.  For a TermCompiler,
this involves multiplying its own weight by the supplied factor;
combining classes such as ORCompiler would apply the factor recursively
to their children.

The default implementation is a no-op; subclasses may wish to multiply
their internal weight by the supplied factor.

=over

=item *

B<factor> - The multiplier.

=back

=head2 normalize

    $compiler->normalize();

Take a newly minted Compiler object and apply query-specific
normalization factors.  Should be invoked by Query subclasses during
L<make_compiler()|Lucy::Search::Query/make_compiler> for top-level nodes.

For a TermQuery, the scoring formula is approximately:

    (tf_d * idf_t / norm_d) * (tf_q * idf_t / norm_q)

L<normalize()|/normalize> is theoretically concerned with applying the second half of
that formula to a the Compiler’s weight. What actually happens depends
on how the Compiler and Similarity methods called internally are
implemented.

=head1 INHERITANCE

Lucy::Search::Compiler isa L<Lucy::Search::Query> isa Clownfish::Obj.

=cut



( run in 0.558 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )