00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <config.h>
00024
00025 #include "synonympostlist.h"
00026
00027 #include "branchpostlist.h"
00028 #include "debuglog.h"
00029
00030 SynonymPostList::~SynonymPostList()
00031 {
00032 delete wt;
00033 delete subtree;
00034 }
00035
00036 void
00037 SynonymPostList::set_weight(const Xapian::Weight * wt_)
00038 {
00039 delete wt;
00040 wt = wt_;
00041 want_doclength = wt->get_sumpart_needs_doclength_();
00042 want_wdf = wt->get_sumpart_needs_wdf_();
00043 }
00044
00045 PostList *
00046 SynonymPostList::next(Xapian::weight w_min)
00047 {
00048 LOGCALL(MATCH, PostList *, "SynonymPostList::next", w_min);
00049 (void)w_min;
00050 next_handling_prune(subtree, 0, matcher);
00051 RETURN(NULL);
00052 }
00053
00054 PostList *
00055 SynonymPostList::skip_to(Xapian::docid did, Xapian::weight w_min)
00056 {
00057 LOGCALL(MATCH, PostList *, "SynonymPostList::skip_to", did | w_min);
00058 (void)w_min;
00059 skip_to_handling_prune(subtree, did, 0, matcher);
00060 RETURN(NULL);
00061 }
00062
00063 Xapian::weight
00064 SynonymPostList::get_weight() const
00065 {
00066 LOGCALL(MATCH, Xapian::weight, "SynonymPostList::get_weight", NO_ARGS);
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 if (want_wdf) {
00080 Xapian::termcount wdf = get_wdf();
00081 Xapian::termcount doclen = get_doclength();
00082 if (wdf > doclen) wdf = doclen;
00083 RETURN(wt->get_sumpart(wdf, doclen));
00084 }
00085 RETURN(wt->get_sumpart(0, want_doclength ? get_doclength() : 0));
00086 }
00087
00088 Xapian::weight
00089 SynonymPostList::get_maxweight() const
00090 {
00091 LOGCALL(MATCH, Xapian::weight, "SynonymPostList::get_maxweight", NO_ARGS);
00092 RETURN(wt->get_maxpart());
00093 }
00094
00095 Xapian::weight
00096 SynonymPostList::recalc_maxweight()
00097 {
00098 LOGCALL(MATCH, Xapian::weight, "SynonymPostList::recalc_maxweight", NO_ARGS);
00099
00100
00101
00102 if (!have_calculated_subtree_maxweights) {
00103 subtree->recalc_maxweight();
00104 have_calculated_subtree_maxweights = true;
00105 }
00106 RETURN(SynonymPostList::get_maxweight());
00107 }
00108
00109 Xapian::termcount
00110 SynonymPostList::get_wdf() const {
00111 LOGCALL(MATCH, Xapian::termcount, "SynonymPostList::get_wdf", NO_ARGS);
00112 RETURN(subtree->get_wdf());
00113 }
00114
00115 Xapian::doccount
00116 SynonymPostList::get_termfreq_min() const {
00117 LOGCALL(MATCH, Xapian::doccount, "SynonymPostList::get_termfreq_min", NO_ARGS);
00118 RETURN(subtree->get_termfreq_min());
00119 }
00120
00121 Xapian::doccount
00122 SynonymPostList::get_termfreq_est() const {
00123 LOGCALL(MATCH, Xapian::doccount, "SynonymPostList::get_termfreq_min", NO_ARGS);
00124 RETURN(subtree->get_termfreq_est());
00125 }
00126
00127 Xapian::doccount
00128 SynonymPostList::get_termfreq_max() const {
00129 LOGCALL(MATCH, Xapian::doccount, "SynonymPostList::get_termfreq_min", NO_ARGS);
00130 RETURN(subtree->get_termfreq_max());
00131 }
00132
00133 Xapian::docid
00134 SynonymPostList::get_docid() const {
00135 LOGCALL(MATCH, Xapian::docid, "SynonymPostList::get_docid", NO_ARGS);
00136 RETURN(subtree->get_docid());
00137 }
00138
00139 Xapian::termcount
00140 SynonymPostList::get_doclength() const {
00141 LOGCALL(MATCH, Xapian::termcount, "SynonymPostList::get_doclength", NO_ARGS);
00142 RETURN(subtree->get_doclength());
00143 }
00144
00145 bool
00146 SynonymPostList::at_end() const {
00147 LOGCALL(MATCH, bool, "SynonymPostList::at_end", NO_ARGS);
00148 RETURN(subtree->at_end());
00149 }
00150
00151 Xapian::termcount
00152 SynonymPostList::count_matching_subqs() const
00153 {
00154 return 1;
00155 }
00156
00157 std::string
00158 SynonymPostList::get_description() const
00159 {
00160 return "(Synonym " + subtree->get_description() + ")";
00161 }