KinoSearch

 view release on metacpan or  search on metacpan

core/KinoSearch/Search/Compiler.cfh  view on Meta::CPAN

     * @param parent The parent Query.
     * @param searcher A KinoSearch::Search::Searcher, such as an
     * IndexSearcher.
     * @param similarity A Similarity.
     * @param boost An arbitrary scoring multiplier.  Defaults to the boost of
     * the parent Query.
     */
    public inert Compiler*
    init(Compiler *self, Query *parent, Searcher *searcher, 
         Similarity *similarity = NULL, float boost);

    /** Factory method returning a Matcher.
     * 
     * @param reader A SegReader.
     * @param need_score Indicate whether the Matcher must implement Score().
     * @return a Matcher, or NULL if the Matcher would have matched no
     * documents.
     */
    public abstract incremented nullable Matcher*
    Make_Matcher(Compiler *self, SegReader *reader, bool_t need_score);

    /** Return the Compiler's numerical weight, a scoring multiplier.  By
     * default, returns the object's boost.
     */
    public float
    Get_Weight(Compiler *self);

    /** Accessor for the Compiler's Similarity object.
     */
    public nullable Similarity*
    Get_Similarity(Compiler *self);

    /** Accessor for the Compiler's parent Query object.
     */
    public Query*
    Get_Parent(Compiler *self);

    /** Compute and return a raw weighting factor.  (This quantity is used by
     * Normalize()).  By default, simply returns 1.0.
     */
    public float
    Sum_Of_Squared_Weights(Compiler *self);

    /** 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.
     * 
     * @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 called at or near the end of
     * construction.
     *
     * For a TermQuery, the scoring formula is approximately:
     * 
     *     ( tf_d * idf_t / norm_d ) * ( tf_q * idf_t / norm_q ) 
     * 
     * 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.  In this case,
     * the span's offset and length are measured in Unicode code points.
     * The default implementation returns an empty array.       
     * 
     * @param searcher A Searcher.
     * @param doc_vec A DocVector.
     * @param field The name of the field.
     */
    public incremented VArray*
    Highlight_Spans(Compiler *self, Searcher *searcher, 
                    DocVector *doc_vec, const CharBuf *field);

    public void
    Serialize(Compiler *self, OutStream *outstream);

    public incremented Compiler*
    Deserialize(Compiler *self, InStream *instream);

    public bool_t
    Equals(Compiler *self, Obj *other);

    public incremented CharBuf*
    To_String(Compiler *self);

    public void
    Destroy(Compiler *self);
}

/* Copyright 2006-2011 Marvin Humphrey
 *
 * This program is free software; you can redistribute it and/or modify
 * under the same terms as Perl itself.
 */



( run in 0.408 second using v1.01-cache-2.11-cpan-5511b514fd6 )