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

** The action table is constructed as a single large table named yy_action[].
** Given state S and lookahead X, the action is computed as
**
**      yy_action[ yy_shift_ofst[S] + X ]
**
** If the index value yy_shift_ofst[S]+X is out of range or if the value
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
** and that yy_default[S] should be used instead.  
**
** The formula above is 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 and YY_REDUCE_USE_DFLT is used in place of
** YY_SHIFT_USE_DFLT.
**
** 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.

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.698 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )