Ticket #394: positional-query-weight-check-first-1.2.patch
File positional-query-weight-check-first-1.2.patch, 2.4 KB (added by , 12 years ago) |
---|
-
matcher/selectpostlist.cc
34 34 PostList *p = source->next(w_min); 35 35 (void)p; 36 36 Assert(p == NULL); // AND should never prune 37 } while (!source->at_end() && !test_doc()); 37 wt = -1; 38 } while (!source->at_end() && 39 (SelectPostList::get_weight() < w_min || !test_doc())); 38 40 RETURN(NULL); 39 41 } 40 42 … … 46 48 PostList *p = source->skip_to(did, w_min); 47 49 (void)p; 48 50 Assert(p == NULL); // AND should never prune 49 if (!source->at_end() && !test_doc()) 51 wt = -1; 52 if (!source->at_end() && 53 (SelectPostList::get_weight() < w_min || !test_doc())) 50 54 RETURN(SelectPostList::next(w_min)); 51 55 } 52 56 RETURN(NULL); … … 59 63 PostList *p = source->check(did, w_min, valid); 60 64 (void)p; 61 65 Assert(p == NULL); // AND should never prune 62 if (valid && !source->at_end() && !test_doc()) 66 wt = -1; 67 if (valid && !source->at_end() && 68 (SelectPostList::get_weight() < w_min || !test_doc())) 63 69 valid = false; 64 70 RETURN(NULL); 65 71 } -
matcher/selectpostlist.h
35 35 36 36 protected: 37 37 PostList *source; 38 mutable double wt; 38 39 39 40 /** Subclasses should override test_doc() with a method which returns 40 41 * true if a document meets the appropriate criterion, false in not … … 50 51 Xapian::doccount get_termfreq_min() const { return 0; } 51 52 Xapian::weight get_maxweight() const { return source->get_maxweight(); } 52 53 Xapian::docid get_docid() const { return source->get_docid(); } 53 Xapian::weight get_weight() const { return source->get_weight(); } 54 Xapian::weight get_weight() const { 55 if (wt < 0.0) 56 wt = source->get_weight(); 57 return wt; 58 } 54 59 Xapian::termcount get_doclength() const { return source->get_doclength(); } 55 60 Xapian::weight recalc_maxweight() { return source->recalc_maxweight(); } 56 61 PositionList * read_position_list() { return source->read_position_list(); } … … 63 68 64 69 std::string get_description() const; 65 70 66 SelectPostList(PostList *source_) : source(source_) { }71 SelectPostList(PostList *source_) : source(source_), wt(-1) { } 67 72 ~SelectPostList() { delete source; } 68 73 }; 69 74