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