Ticket #464: bug-464-fix.patch

File bug-464-fix.patch, 1.1 KB (added by Olly Betts, 15 years ago)

candidate fix

  • matcher/multimatch.cc

     
    318318{
    319319    DEBUGCALL(MATCH, void, "MultiMatch::get_mset", first << ", " << maxitems
    320320              << ", " << check_at_least << ", ...");
    321     if (check_at_least < maxitems) check_at_least = maxitems;
     321    {
     322        Xapian::doccount docs = db.get_doccount();
     323        maxitems = min(maxitems, docs);
     324        check_at_least = min(check_at_least, docs);
     325        check_at_least = max(check_at_least, maxitems);
     326    }
    322327
    323328    if (!query) {
    324329        mset = Xapian::MSet(); // FIXME: mset.get_firstitem() will return 0 not first
     
    893898            = items.size();
    894899        if (collapser && matches_lower_bound > uncollapsed_lower_bound)
    895900            uncollapsed_lower_bound = matches_lower_bound;
    896     } else if (docs_matched < check_at_least) {
     901    } else if (docs_matched + collapser.get_dups_ignored() < check_at_least) {
    897902        // We have seen fewer matches than we checked for, so we must have seen
    898903        // all the matches.
    899904        LOGLINE(MATCH, "Setting bounds equal");