Ticket #216: bug216-fix.patch

File bug216-fix.patch, 1.9 KB (added by Olly Betts, 15 years ago)

Patch to fix this issue

  • matcher/multimatch.cc

     
    478478    bool is_heap = false;
    479479
    480480    while (true) {
     481        bool pushback;
     482
    481483        if (rare(recalculate_w_max)) {
    482484            if (min_weight > 0.0) {
    483485                if (rare(getorrecalc_maxweight(pl) < min_weight)) {
     
    544546                    // processing needed.
    545547                    LOGLINE(MATCH, "Making note of match item which sorts lower than min_item");
    546548                    ++docs_matched;
     549                    if (!calculated_weight) wt = pl->get_weight();
     550                    if (wt > greatest_wt) goto new_greatest_weight;
    547551                    continue;
    548552                }
    549553                if (docs_matched >= check_at_least) {
    550554                    // We've seen enough items - we can drop this one.
    551555                    LOGLINE(MATCH, "Dropping candidate which sorts lower than min_item");
     556                    // FIXME: hmm, match decider might have rejected this...
     557                    if (!calculated_weight) wt = pl->get_weight();
     558                    if (wt > greatest_wt) goto new_greatest_weight;
    552559                    continue;
    553560                }
    554561                // We can't drop the item, because we need to show it
     
    590597            new_item.wt = wt;
    591598        }
    592599
    593         bool pushback = true;
     600        pushback = true;
    594601        documents_considered++;
    595602
    596603        // Perform collapsing on key if requested.
     
    623630                        if (new_item.wt > oldkey->second.second) {
    624631                            oldkey->second.second = new_item.wt;
    625632                        }
     633                        // If we're sorting by relevance primarily, then we
     634                        // throw away the lower weighted document anyway.
     635                        if (sort_by != REL && sort_by != REL_VAL) {
     636                            if (wt > greatest_wt) goto new_greatest_weight;
     637                        }
    626638                        continue;
    627639                    }
    628640                    // Make a note of the updated collapse count in the
     
    734746
    735747        // Keep a track of the greatest weight we've seen.
    736748        if (wt > greatest_wt) {
     749new_greatest_weight:
    737750            greatest_wt = wt;
    738751            if (percent_cutoff) {
    739752                Xapian::weight w = wt * percent_cutoff_factor;