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_PHRASEPOSTLIST_H
00025 #define OM_HGUARD_PHRASEPOSTLIST_H
00026
00027 #include "selectpostlist.h"
00028 #include <vector>
00029
00030 typedef Xapian::PositionIterator::Internal PositionList;
00031
00039 class NearPostList : public SelectPostList {
00040 private:
00041 Xapian::termpos window;
00042 std::vector<PostList *> terms;
00043
00044 bool test_doc();
00045 bool do_test(std::vector<PositionList *> &plists, Xapian::termcount i,
00046 Xapian::termcount min, Xapian::termcount max);
00047 public:
00048 std::string get_description() const;
00049 Xapian::termcount get_wdf() const;
00050
00051 Xapian::doccount get_termfreq_est() const
00052 {
00053
00054 return source->get_termfreq_est() / 2;
00055 }
00056
00057 TermFreqs get_termfreq_est_using_stats(
00058 const Xapian::Weight::Internal & stats) const;
00059
00060 NearPostList(PostList *source_, Xapian::termpos window_,
00061 std::vector<PostList *>::const_iterator &terms_begin_,
00062 std::vector<PostList *>::const_iterator &terms_end_)
00063 : SelectPostList(source_), terms(terms_begin_, terms_end_)
00064 {
00065 window = window_;
00066 }
00067 };
00068
00076 class PhrasePostList : public SelectPostList {
00077 private:
00078 Xapian::termpos window;
00079 std::vector<PostList *> terms;
00080
00081 bool test_doc();
00082 bool do_test(std::vector<PositionList *> &plists, Xapian::termcount i,
00083 Xapian::termcount min, Xapian::termcount max);
00084 public:
00085 std::string get_description() const;
00086 Xapian::termcount get_wdf() const;
00087
00088 Xapian::doccount get_termfreq_est() const
00089 {
00090
00091 return source->get_termfreq_est() / 3;
00092 }
00093
00094 TermFreqs get_termfreq_est_using_stats(
00095 const Xapian::Weight::Internal & stats) const;
00096
00097 PhrasePostList(PostList *source_, Xapian::termpos window_,
00098 std::vector<PostList *>::const_iterator &terms_begin_,
00099 std::vector<PostList *>::const_iterator &terms_end_)
00100 : SelectPostList(source_), terms(terms_begin_, terms_end_)
00101 {
00102 window = window_;
00103 }
00104 };
00105
00106 #endif