00001 00004 /* Copyright 2007,2009 Lemur Consulting Ltd 00005 * Copyright 2009 Olly Betts 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #ifndef XAPIAN_INCLUDED_SYNONYMPOSTLIST_H 00023 #define XAPIAN_INCLUDED_SYNONYMPOSTLIST_H 00024 00025 #include "multimatch.h" 00026 #include "postlist.h" 00027 00034 class SynonymPostList : public PostList { 00038 PostList * subtree; 00039 00045 MultiMatch * matcher; 00046 00048 const Xapian::Weight * wt; 00049 00051 bool want_doclength; 00052 00054 bool want_wdf; 00055 00057 bool have_calculated_subtree_maxweights; 00058 00059 public: 00060 SynonymPostList(PostList * subtree_, MultiMatch * matcher_) 00061 : subtree(subtree_), matcher(matcher_), wt(NULL), 00062 want_doclength(false), want_wdf(false), 00063 have_calculated_subtree_maxweights(false) { } 00064 00065 ~SynonymPostList(); 00066 00072 void set_weight(const Xapian::Weight * wt_); 00073 00074 PostList *next(Xapian::weight w_min); 00075 PostList *skip_to(Xapian::docid did, Xapian::weight w_min); 00076 00077 Xapian::weight get_weight() const; 00078 Xapian::weight get_maxweight() const; 00079 Xapian::weight recalc_maxweight(); 00080 00081 // The following methods just call through to the subtree. 00082 Xapian::termcount get_wdf() const; 00083 Xapian::doccount get_termfreq_min() const; 00084 Xapian::doccount get_termfreq_est() const; 00085 Xapian::doccount get_termfreq_max() const; 00086 // Note - we don't need to implement get_termfreq_est_using_stats() 00087 // because a synonym when used as a child of a synonym will be optimised 00088 // to an OR. 00089 Xapian::docid get_docid() const; 00090 Xapian::termcount get_doclength() const; 00091 bool at_end() const; 00092 00093 Xapian::termcount count_matching_subqs() const; 00094 00095 std::string get_description() const; 00096 }; 00097 00098 #endif /* XAPIAN_INCLUDED_SYNONYMPOSTLIST_H */