00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef OM_HGUARD_BRANCHPOSTLIST_H
00024 #define OM_HGUARD_BRANCHPOSTLIST_H
00025
00026 #include "multimatch.h"
00027 #include "postlist.h"
00028
00036 class BranchPostList : public PostList {
00037 private:
00038
00039 BranchPostList(const BranchPostList &);
00040 BranchPostList & operator=(const BranchPostList &);
00041
00042 protected:
00044 PostList *l;
00045
00047 PostList *r;
00048
00054 MultiMatch *matcher;
00055
00059 void handle_prune(PostList *&kid, PostList *ret) {
00060 if (ret) {
00061 delete kid;
00062 kid = ret;
00063
00064
00065 matcher->recalc_maxweight();
00066 }
00067 }
00068
00069 public:
00070 BranchPostList(PostList *l_, PostList *r_, MultiMatch *matcher_)
00071 : l(l_), r(r_), matcher(matcher_) {}
00072
00073 virtual ~BranchPostList();
00074 };
00075
00076
00077
00078
00079
00080
00081 inline bool
00082 next_handling_prune(PostList * & pl, Xapian::weight w_min,
00083 MultiMatch *matcher)
00084 {
00085 PostList *p = pl->next(w_min);
00086 if (!p) return false;
00087 delete pl;
00088 pl = p;
00089
00090 if (matcher) matcher->recalc_maxweight();
00091 return true;
00092 }
00093
00094 inline bool
00095 skip_to_handling_prune(PostList * & pl, Xapian::docid did, Xapian::weight w_min,
00096 MultiMatch *matcher)
00097 {
00098 PostList *p = pl->skip_to(did, w_min);
00099 if (!p) return false;
00100 delete pl;
00101 pl = p;
00102
00103 if (matcher) matcher->recalc_maxweight();
00104 return true;
00105 }
00106
00107 inline bool
00108 check_handling_prune(PostList * & pl, Xapian::docid did, Xapian::weight w_min,
00109 MultiMatch *matcher, bool & valid)
00110 {
00111 PostList *p = pl->check(did, w_min, valid);
00112 if (!p) return false;
00113 delete pl;
00114 pl = p;
00115
00116 if (matcher) matcher->recalc_maxweight();
00117 return true;
00118 }
00119
00120 #endif