00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #include "msetpostlist.h"
00024
00025 #include "debuglog.h"
00026 #include "omassert.h"
00027
00028 Xapian::doccount
00029 MSetPostList::get_termfreq_min() const
00030 {
00031 LOGCALL(MATCH, Xapian::doccount, "MSetPostList::get_termfreq_min", NO_ARGS);
00032 RETURN(mset_internal->matches_lower_bound);
00033 }
00034
00035 Xapian::doccount
00036 MSetPostList::get_termfreq_est() const
00037 {
00038 LOGCALL(MATCH, Xapian::doccount, "MSetPostList::get_termfreq_est", NO_ARGS);
00039 RETURN(mset_internal->matches_estimated);
00040 }
00041
00042 Xapian::doccount
00043 MSetPostList::get_termfreq_max() const
00044 {
00045 LOGCALL(MATCH, Xapian::doccount, "MSetPostList::get_termfreq_max", NO_ARGS);
00046 RETURN(mset_internal->matches_upper_bound);
00047 }
00048
00049 Xapian::weight
00050 MSetPostList::get_maxweight() const
00051 {
00052 LOGCALL(MATCH, Xapian::weight, "MSetPostList::get_maxweight", NO_ARGS);
00053
00054
00055 if (cursor == -1) RETURN(mset_internal->max_possible);
00056
00057
00058
00059 if (decreasing_relevance) {
00060
00061 if (at_end()) RETURN(0);
00062 RETURN(mset_internal->items[cursor].wt);
00063 }
00064
00065
00066 RETURN(mset_internal->max_attained);
00067 }
00068
00069 Xapian::docid
00070 MSetPostList::get_docid() const
00071 {
00072 LOGCALL(MATCH, Xapian::docid, "MSetPostList::get_docid", NO_ARGS);
00073 Assert(cursor != -1);
00074 RETURN(mset_internal->items[cursor].did);
00075 }
00076
00077 Xapian::weight
00078 MSetPostList::get_weight() const
00079 {
00080 LOGCALL(MATCH, Xapian::weight, "MSetPostList::get_weight", NO_ARGS);
00081 Assert(cursor != -1);
00082 RETURN(mset_internal->items[cursor].wt);
00083 }
00084
00085 const string *
00086 MSetPostList::get_collapse_key() const
00087 {
00088 LOGCALL(MATCH, string *, "MSetPostList::get_collapse_key", NO_ARGS);
00089 Assert(cursor != -1);
00090 RETURN(&mset_internal->items[cursor].collapse_key);
00091 }
00092
00093 Xapian::termcount
00094 MSetPostList::get_doclength() const
00095 {
00096 throw Xapian::UnimplementedError("MSetPostList::get_doclength() unimplemented");
00097 }
00098
00099 Xapian::weight
00100 MSetPostList::recalc_maxweight()
00101 {
00102 LOGCALL(MATCH, Xapian::weight, "MSetPostList::recalc_maxweight", NO_ARGS);
00103 RETURN(MSetPostList::get_maxweight());
00104 }
00105
00106 PostList *
00107 MSetPostList::next(Xapian::weight w_min)
00108 {
00109 LOGCALL(MATCH, PostList *, "MSetPostList::next", w_min);
00110 Assert(cursor == -1 || !at_end());
00111 ++cursor;
00112 if (decreasing_relevance) {
00113
00114
00115
00116 if (!at_end() && mset_internal->items[cursor].wt < w_min)
00117 cursor = mset_internal->items.size();
00118 } else {
00119
00120 while (!at_end() && mset_internal->items[cursor].wt < w_min)
00121 ++cursor;
00122 }
00123 RETURN(NULL);
00124 }
00125
00126 PostList *
00127 MSetPostList::skip_to(Xapian::docid, Xapian::weight)
00128 {
00129
00130
00131
00132 throw Xapian::InvalidOperationError("MSetPostList::skip_to not meaningful");
00133 }
00134
00135 bool
00136 MSetPostList::at_end() const
00137 {
00138 LOGCALL(MATCH, bool, "MSetPostList::at_end", NO_ARGS);
00139 Assert(cursor != -1);
00140 RETURN(size_t(cursor) >= mset_internal->items.size());
00141 }
00142
00143 string
00144 MSetPostList::get_description() const
00145 {
00146 string desc("(MSet ");
00147 desc += mset_internal->get_description();
00148 desc += ')';
00149 return desc;
00150 }