Ticket #476: andmaybe_skip_doc.patch
File andmaybe_skip_doc.patch, 4.2 KB (added by , 15 years ago) |
---|
-
matcher/andmaybepostlist.h
108 108 rmax = r->get_maxweight(); 109 109 } 110 110 111 /** Synchronise the RHS to the LHS after construction. 112 * Used after constructing from a decomposing OrPostList 113 */ 114 PostList * sync_rhs(Xapian::weight w_min); 115 111 116 /** get_wdf() for ANDMAYBE postlists returns the sum of the wdfs of the 112 117 * sub postlists which are at the current document - this is desirable 113 118 * when the ANDMAYBE is part of a synonym. -
matcher/orpostlist.cc
58 58 matcher); 59 59 } else { 60 60 LOGLINE(MATCH, "OR -> AND MAYBE (1)"); 61 ret = new AndMaybePostList(r, l, matcher, dbsize, rhead, lhead); 62 next_handling_prune(ret, w_min, matcher); 61 AndMaybePostList * ret2 = 62 new AndMaybePostList(r, l, matcher, dbsize, rhead, lhead); 63 ret = ret2; 64 // Advance the AndMaybePostList unless the old RHS postlist was 65 // already ahead of the current docid. 66 if ((rhead <= lhead)) { 67 next_handling_prune(ret, w_min, matcher); 68 } else { 69 handle_prune(ret, ret2->sync_rhs(w_min)); 70 } 63 71 } 64 72 } else { 65 73 // w_min > rmax since w_min > minmax but not (w_min > lmax) 66 74 Assert(w_min > rmax); 67 75 LOGLINE(MATCH, "OR -> AND MAYBE (2)"); 68 ret = new AndMaybePostList(l, r, matcher, dbsize, lhead, rhead); 69 next_handling_prune(ret, w_min, matcher); 76 AndMaybePostList * ret2 = 77 new AndMaybePostList(l, r, matcher, dbsize, lhead, rhead); 78 ret = ret2; 79 if ((lhead <= rhead)) { 80 next_handling_prune(ret, w_min, matcher); 81 } else { 82 handle_prune(ret, ret2->sync_rhs(w_min)); 83 } 70 84 } 71 85 72 86 l = r = NULL; … … 118 132 did = std::max(did, std::max(lhead, rhead)); 119 133 } else { 120 134 LOGLINE(MATCH, "OR -> AND MAYBE (in skip_to) (1)"); 121 ret = new AndMaybePostList(r, l, matcher, dbsize, rhead, lhead); 135 AndMaybePostList * ret2 = 136 new AndMaybePostList(r, l, matcher, dbsize, rhead, lhead); 137 ret = ret2; 138 handle_prune(ret, ret2->sync_rhs(w_min)); 122 139 did = std::max(did, rhead); 123 140 } 124 141 } else { 125 142 // w_min > rmax since w_min > minmax but not (w_min > lmax) 126 143 Assert(w_min > rmax); 127 144 LOGLINE(MATCH, "OR -> AND MAYBE (in skip_to) (2)"); 128 ret = new AndMaybePostList(l, r, matcher, dbsize, lhead, rhead); 145 AndMaybePostList * ret2 = 146 new AndMaybePostList(l, r, matcher, dbsize, lhead, rhead); 147 ret = ret2; 148 handle_prune(ret, ret2->sync_rhs(w_min)); 129 149 did = std::max(did, lhead); 130 150 } 131 151 … … 175 195 did = std::max(did, std::max(lhead, rhead)); 176 196 } else { 177 197 LOGLINE(MATCH, "OR -> AND MAYBE (in check) (1)"); 178 ret = new AndMaybePostList(r, l, matcher, dbsize, rhead, lhead); 198 AndMaybePostList * ret2 = new AndMaybePostList(r, l, matcher, dbsize, rhead, lhead); 199 ret = ret2; 200 handle_prune(ret, ret2->sync_rhs(w_min)); 179 201 did = std::max(did, rhead); 180 202 } 181 203 } else { … … 183 205 Assert(w_min > rmax); 184 206 LOGLINE(MATCH, "OR -> AND MAYBE (in check) (2)"); 185 207 ret = new AndMaybePostList(l, r, matcher, dbsize, lhead, rhead); 208 209 AndMaybePostList * ret2 = new AndMaybePostList(l, r, matcher, dbsize, lhead, rhead); 210 ret = ret2; 211 handle_prune(ret, ret2->sync_rhs(w_min)); 186 212 did = std::max(did, lhead); 187 213 } 188 214 -
matcher/andmaybepostlist.cc
58 58 } 59 59 60 60 PostList * 61 AndMaybePostList::sync_rhs(Xapian::weight w_min) 62 { 63 DEBUGCALL(MATCH, PostList *, "AndMaybePostList::sync_rhs", w_min); 64 bool valid; 65 check_handling_prune(r, lhead, w_min - lmax, matcher, valid); 66 if (r->at_end()) { 67 PostList *tmp = l; 68 l = NULL; 69 RETURN(tmp); 70 } 71 if (valid) { 72 rhead = r->get_docid(); 73 } else { 74 rhead = 0; 75 } 76 RETURN(NULL); 77 } 78 79 PostList * 61 80 AndMaybePostList::next(Xapian::weight w_min) 62 81 { 63 82 DEBUGCALL(MATCH, PostList *, "AndMaybePostList::next", w_min);