diff --git a/xapian-core/matcher/selectpostlist.cc b/xapian-core/matcher/selectpostlist.cc
index 28f2544..a5de30d 100644
a
|
b
|
SelectPostList::next(double w_min)
|
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 | |
… |
… |
SelectPostList::skip_to(Xapian::docid did, double w_min)
|
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); |
… |
… |
SelectPostList::check(Xapian::docid did, double w_min, bool &valid)
|
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 | } |
diff --git a/xapian-core/matcher/selectpostlist.h b/xapian-core/matcher/selectpostlist.h
index 41151f9..c06b9e3 100644
a
|
b
|
class SelectPostList : public PostList {
|
36 | 36 | |
37 | 37 | protected: |
38 | 38 | PostList *source; |
| 39 | mutable double wt; |
39 | 40 | |
40 | 41 | /** Subclasses should override test_doc() with a method which returns |
41 | 42 | * true if a document meets the appropriate criterion, false in not |
… |
… |
class SelectPostList : public PostList {
|
51 | 52 | Xapian::doccount get_termfreq_min() const { return 0; } |
52 | 53 | double get_maxweight() const { return source->get_maxweight(); } |
53 | 54 | Xapian::docid get_docid() const { return source->get_docid(); } |
54 | | double get_weight() const { return source->get_weight(); } |
| 55 | double get_weight() const { |
| 56 | if (wt < 0.0) |
| 57 | wt = source->get_weight(); |
| 58 | return wt; |
| 59 | } |
55 | 60 | Xapian::termcount get_doclength() const { return source->get_doclength(); } |
56 | 61 | double recalc_maxweight() { return source->recalc_maxweight(); } |
57 | 62 | PositionList * read_position_list() { return source->read_position_list(); } |
… |
… |
class SelectPostList : public PostList {
|
64 | 69 | |
65 | 70 | std::string get_description() const; |
66 | 71 | |
67 | | SelectPostList(PostList *source_) : source(source_) { } |
| 72 | SelectPostList(PostList *source_) : source(source_), wt(-1) { } |
68 | 73 | ~SelectPostList() { delete source; } |
69 | 74 | }; |
70 | 75 | |