Ticket #174: check-at-least.patch
File check-at-least.patch, 1.5 KB (added by , 17 years ago) |
---|
-
matcher/multimatch.cc
348 348 349 349 // Set max number of results that we want - this is used to decide 350 350 // when to throw away unwanted items. 351 Xapian::doccount max_msize = first + check_at_least;351 Xapian::doccount max_msize = first + maxitems; 352 352 items.reserve(max_msize + 1); 353 353 354 354 // Tracks the minimum item currently eligible for the MSet - we compare … … 560 560 561 561 min_item = items.front(); 562 562 if (sort_by == REL || sort_by == REL_VAL) { 563 if (min_item.wt > min_weight) min_weight = min_item.wt; 563 if (docs_matched >= check_at_least) { 564 if (min_item.wt > min_weight) min_weight = min_item.wt; 565 } 564 566 } 565 567 if (getorrecalc_maxweight(pl) < min_weight) { 566 568 DEBUGLINE(MATCH, "*** TERMINATING EARLY (3)"); … … 742 744 743 745 DEBUGLINE(MATCH, items.size() << " items in potential mset"); 744 746 745 if (check_at_least > maxitems) {746 // Remove unwanted trailing entries747 if (maxitems == 0) {748 items.clear();749 } else if (items.size() > first + maxitems) {750 nth_element(items.begin(),751 items.begin() + first + maxitems,752 items.end(),753 mcmp);754 // Erase the unwanted trailing items.755 items.erase(items.begin() + first + maxitems, items.end());756 }757 }758 747 if (first > 0) { 759 748 // Remove unwanted leading entries 760 749 if (items.size() <= first) {