Exemple #1
0
HitDoc*
Hits_next(Hits *self) {
    MatchDoc *match_doc = (MatchDoc*)VA_Fetch(self->match_docs, self->offset);
    self->offset++;

    if (!match_doc) {
        /** Bail if there aren't any more *captured* hits. (There may be more
         * total hits.) */
        return NULL;
    }
    else {
        // Lazily fetch HitDoc, set score.
        HitDoc *hit_doc = Searcher_Fetch_Doc(self->searcher,
                                             match_doc->doc_id);
        HitDoc_Set_Score(hit_doc, match_doc->score);
        return hit_doc;
    }
}
Exemple #2
0
HitDoc*
Hits_Next_IMP(Hits *self) {
    HitsIVARS *const ivars = Hits_IVARS(self);
    MatchDoc *match_doc = (MatchDoc*)VA_Fetch(ivars->match_docs, ivars->offset);
    ivars->offset++;

    if (!match_doc) {
        /** Bail if there aren't any more *captured* hits. (There may be more
         * total hits.) */
        return NULL;
    }
    else {
        // Lazily fetch HitDoc, set score.
        MatchDocIVARS *match_doc_ivars = MatchDoc_IVARS(match_doc);
        HitDoc *hit_doc = Searcher_Fetch_Doc(ivars->searcher,
                                             match_doc_ivars->doc_id);
        HitDoc_Set_Score(hit_doc, match_doc_ivars->score);
        return hit_doc;
    }
}