Lucy

 view release on metacpan or  search on metacpan

cfcore/Lucy/Index/SegPostingList.c  view on Meta::CPAN

        SkipStepperIVARS *const skip_stepper_ivars
            = SkipStepper_IVARS(skip_stepper);
        int32_t new_doc_id              = skip_stepper_ivars->doc_id;
        int64_t new_filepos             = InStream_Tell(post_stream);

        /* Assuming the default skip_interval of 16...
         *
         * Say we're currently on the 5th doc matching this term, and we get a
         * request to skip to the 18th doc matching it.  We won't have skipped
         * yet, but we'll have already gone past 5 of the 16 skip docs --
         * ergo, the modulus in the following formula.
         */
        int32_t num_skipped = 0 - ((int32_t)ivars->count % skip_interval);
        if (num_skipped == 0 && ivars->count != 0) {
            num_skipped = 0 - skip_interval;
        }

        // See if there's anything to skip.
        while (target > skip_stepper_ivars->doc_id) {
            new_doc_id  = skip_stepper_ivars->doc_id;
            new_filepos = skip_stepper_ivars->filepos;

cfcore/Lucy/Search/Compiler.cfh  view on Meta::CPAN

     *
     * @param factor The multiplier.
     */
    public void
    Apply_Norm_Factor(Compiler *self, float factor);

    /**  Take a newly minted Compiler object and apply query-specific
     * normalization factors.  Should be invoked by Query subclasses during
     * [](cfish:.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)
     *
     * [](cfish:.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.
     */
    public void
    Normalize(Compiler *self);

    /** Return an array of Span objects, indicating where in the given field
     * the text that matches the parent Query occurs and how well each snippet
     * matches.  The Span's offset and length are measured in Unicode code
     * points.

cfcore/Lucy/Search/TermQuery.c  view on Meta::CPAN

void
TermCompiler_Apply_Norm_Factor_IMP(TermCompiler *self,
                                   float query_norm_factor) {
    TermCompilerIVARS *const ivars = TermCompiler_IVARS(self);
    ivars->query_norm_factor = query_norm_factor;

    /* Multiply raw weight by the idf and norm_q factors in this:
     *
     *      (tf_q * idf_q / norm_q)
     *
     * Note: factoring in IDF a second time is correct.  See formula.
     */
    ivars->normalized_weight
        = ivars->raw_weight * ivars->idf * query_norm_factor;
}

float
TermCompiler_Get_Weight_IMP(TermCompiler *self) {
    return TermCompiler_IVARS(self)->normalized_weight;
}

lemon/lempar.c  view on Meta::CPAN

**
**   N between YY_MIN_REDUCE            Reduce by rule N-YY_MIN_REDUCE
**     and YY_MAX_REDUCE
**
** The action table is constructed as a single large table named yy_action[].
** Given state S and lookahead X, the action is computed as either:
**
**    (A)   N = yy_action[ yy_shift_ofst[S] + X ]
**    (B)   N = yy_default[S]
**
** The (A) formula is preferred.  The B formula is used instead if
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
**
** The formulas above are for computing the action when the lookahead is
** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
** the yy_shift_ofst[] array.
**
** The following are the tables generated in this section:
**
**  yy_action[]        A single table containing all actions.
**  yy_lookahead[]     A table containing the lookahead for each entry in
**                     yy_action.  Used to detect hash collisions.
**  yy_shift_ofst[]    For each state, the offset into yy_action for

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

=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.652 second using v1.01-cache-2.11-cpan-a49fcb8fa48 )