diff options
Diffstat (limited to 'rep/usr/include/xapian/enquire.h.gcov.html')
-rw-r--r-- | rep/usr/include/xapian/enquire.h.gcov.html | 1361 |
1 files changed, 0 insertions, 1361 deletions
diff --git a/rep/usr/include/xapian/enquire.h.gcov.html b/rep/usr/include/xapian/enquire.h.gcov.html deleted file mode 100644 index 15ca5f0..0000000 --- a/rep/usr/include/xapian/enquire.h.gcov.html +++ /dev/null @@ -1,1361 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> - <title>LCOV - lcov.info - /usr/include/xapian/enquire.h</title> - <link rel="stylesheet" type="text/css" href="../../../gcov.css"> -</head> - -<body> - - <table width="100%" border=0 cellspacing=0 cellpadding=0> - <tr><td class="title">LTP GCOV extension - code coverage report</td></tr> - <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> - - <tr> - <td width="100%"> - <table cellpadding=1 border=0 width="100%"> - <tr> - <td class="headerItem" width="20%">Current view:</td> - <td class="headerValue" width="80%" colspan=4><a href="../../../index.html">directory</a> - <a href="index.html">usr/include/xapian</a> - enquire.h</td> - </tr> - <tr> - <td class="headerItem" width="20%">Test:</td> - <td class="headerValue" width="80%" colspan=4>lcov.info</td> - </tr> - <tr> - <td class="headerItem" width="20%">Date:</td> - <td class="headerValue" width="20%">2008-08-14</td> - <td width="20%"></td> - <td class="headerItem" width="20%">Instrumented lines:</td> - <td class="headerValue" width="20%">29</td> - </tr> - <tr> - <td class="headerItem" width="20%">Code covered:</td> - <td class="headerValue" width="20%">89.7 %</td> - <td width="20%"></td> - <td class="headerItem" width="20%">Executed lines:</td> - <td class="headerValue" width="20%">26</td> - </tr> - </table> - </td> - </tr> - <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> - </table> - - <table cellpadding=0 cellspacing=0 border=0> - <tr> - <td><br></td> - </tr> - <tr> - <td><pre class="source"> -<span class="lineNum"> 1 </span> : /** \file enquire.h -<span class="lineNum"> 2 </span> : * \brief API for running queries -<span class="lineNum"> 3 </span> : */ -<span class="lineNum"> 4 </span> : /* Copyright 1999,2000,2001 BrightStation PLC -<span class="lineNum"> 5 </span> : * Copyright 2001,2002 Ananova Ltd -<span class="lineNum"> 6 </span> : * Copyright 2002,2003,2004,2005,2006,2007 Olly Betts -<span class="lineNum"> 7 </span> : * -<span class="lineNum"> 8 </span> : * This program is free software; you can redistribute it and/or -<span class="lineNum"> 9 </span> : * modify it under the terms of the GNU General Public License as -<span class="lineNum"> 10 </span> : * published by the Free Software Foundation; either version 2 of the -<span class="lineNum"> 11 </span> : * License, or (at your option) any later version. -<span class="lineNum"> 12 </span> : * -<span class="lineNum"> 13 </span> : * This program is distributed in the hope that it will be useful, -<span class="lineNum"> 14 </span> : * but WITHOUT ANY WARRANTY; without even the implied warranty of -<span class="lineNum"> 15 </span> : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -<span class="lineNum"> 16 </span> : * GNU General Public License for more details. -<span class="lineNum"> 17 </span> : * -<span class="lineNum"> 18 </span> : * You should have received a copy of the GNU General Public License -<span class="lineNum"> 19 </span> : * along with this program; if not, write to the Free Software -<span class="lineNum"> 20 </span> : * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 -<span class="lineNum"> 21 </span> : * USA -<span class="lineNum"> 22 </span> : */ -<span class="lineNum"> 23 </span> : -<span class="lineNum"> 24 </span> : #ifndef XAPIAN_INCLUDED_ENQUIRE_H -<span class="lineNum"> 25 </span> : #define XAPIAN_INCLUDED_ENQUIRE_H -<span class="lineNum"> 26 </span> : -<span class="lineNum"> 27 </span> : #include <string> -<span class="lineNum"> 28 </span> : -<span class="lineNum"> 29 </span> : #include <xapian/base.h> -<span class="lineNum"> 30 </span> : #include <xapian/deprecated.h> -<span class="lineNum"> 31 </span> : #include <xapian/sorter.h> -<span class="lineNum"> 32 </span> : #include <xapian/types.h> -<span class="lineNum"> 33 </span> : #include <xapian/termiterator.h> -<span class="lineNum"> 34 </span> : #include <xapian/visibility.h> -<span class="lineNum"> 35 </span> : -<span class="lineNum"> 36 </span> : namespace Xapian { -<span class="lineNum"> 37 </span> : -<span class="lineNum"> 38 </span> : class Database; -<span class="lineNum"> 39 </span> : class Document; -<span class="lineNum"> 40 </span> : class ErrorHandler; -<span class="lineNum"> 41 </span> : class ExpandDecider; -<span class="lineNum"> 42 </span> : class MSetIterator; -<span class="lineNum"> 43 </span> : class Query; -<span class="lineNum"> 44 </span> : class Weight; -<span class="lineNum"> 45 </span> : -<span class="lineNum"> 46 </span> : /** A match set (MSet). -<span class="lineNum"> 47 </span> : * This class represents (a portion of) the results of a query. -<span class="lineNum"> 48 </span> : */ -<span class="lineNum"> 49 </span> : class XAPIAN_VISIBILITY_DEFAULT MSet { -<span class="lineNum"> 50 </span> : public: -<span class="lineNum"> 51 </span> : class Internal; -<span class="lineNum"> 52 </span> : /// @internal Reference counted internals. -<span class="lineNum"> 53 </span> : Xapian::Internal::RefCntPtr<Internal> internal; -<span class="lineNum"> 54 </span> : -<span class="lineNum"> 55 </span> : /// @internal Constructor for internal use. -<span class="lineNum"> 56 </span> : explicit MSet(MSet::Internal * internal_); -<span class="lineNum"> 57 </span> : -<span class="lineNum"> 58 </span> : /// Create an empty Xapian::MSet. -<span class="lineNum"> 59 </span> : MSet(); -<span class="lineNum"> 60 </span> : -<span class="lineNum"> 61 </span> : /// Destroy a Xapian::MSet. -<span class="lineNum"> 62 </span> : ~MSet(); -<span class="lineNum"> 63 </span> : -<span class="lineNum"> 64 </span> : /// Copying is allowed (and is cheap). -<span class="lineNum"> 65 </span> : MSet(const MSet & other); -<span class="lineNum"> 66 </span> : -<span class="lineNum"> 67 </span> : /// Assignment is allowed (and is cheap). -<span class="lineNum"> 68 </span> : void operator=(const MSet &other); -<span class="lineNum"> 69 </span> : -<span class="lineNum"> 70 </span> : /** Fetch the document info for a set of items in the MSet. -<span class="lineNum"> 71 </span> : * -<span class="lineNum"> 72 </span> : * This method causes the documents in the range specified by the -<span class="lineNum"> 73 </span> : * iterators to be fetched from the database, and cached in the -<span class="lineNum"> 74 </span> : * Xapian::MSet object. This has little effect when performing a -<span class="lineNum"> 75 </span> : * search across a local database, but will greatly speed up -<span class="lineNum"> 76 </span> : * subsequent access to the document contents when the documents are -<span class="lineNum"> 77 </span> : * stored in a remote database. -<span class="lineNum"> 78 </span> : * -<span class="lineNum"> 79 </span> : * The iterators must be over this Xapian::MSet - undefined behaviour -<span class="lineNum"> 80 </span> : * will result otherwise. -<span class="lineNum"> 81 </span> : * -<span class="lineNum"> 82 </span> : * @param begin MSetIterator for first item to fetch. -<span class="lineNum"> 83 </span> : * @param end MSetIterator for item after last item to fetch. -<span class="lineNum"> 84 </span> : */ -<span class="lineNum"> 85 </span> : void fetch(const MSetIterator &begin, const MSetIterator &end) const; -<span class="lineNum"> 86 </span> : -<span class="lineNum"> 87 </span> : /** Fetch the single item specified. -<span class="lineNum"> 88 </span> : */ -<span class="lineNum"> 89 </span> : void fetch(const MSetIterator &item) const; -<span class="lineNum"> 90 </span> : -<span class="lineNum"> 91 </span> : /** Fetch all the items in the MSet. -<span class="lineNum"> 92 </span> : */ -<span class="lineNum"> 93 </span> : void fetch() const; -<span class="lineNum"> 94 </span> : -<span class="lineNum"> 95 </span> : /** This converts the weight supplied to a percentage score. -<span class="lineNum"> 96 </span> : * The return value will be in the range 0 to 100, and will be 0 if -<span class="lineNum"> 97 </span> : * and only if the item did not match the query at all. -<span class="lineNum"> 98 </span> : */ -<span class="lineNum"> 99 </span> : Xapian::percent convert_to_percent(Xapian::weight wt) const; -<span class="lineNum"> 100 </span> : -<span class="lineNum"> 101 </span> : /// Return the percentage score for a particular item. -<span class="lineNum"> 102 </span> : Xapian::percent convert_to_percent(const MSetIterator &it) const; -<span class="lineNum"> 103 </span> : -<span class="lineNum"> 104 </span> : /** Return the term frequency of the given query term. -<span class="lineNum"> 105 </span> : * -<span class="lineNum"> 106 </span> : * @param tname The term to look for. -<span class="lineNum"> 107 </span> : * -<span class="lineNum"> 108 </span> : * @exception Xapian::InvalidArgumentError is thrown if the term was -<span class="lineNum"> 109 </span> : * not in the query. -<span class="lineNum"> 110 </span> : */ -<span class="lineNum"> 111 </span> : Xapian::doccount get_termfreq(const std::string &tname) const; -<span class="lineNum"> 112 </span> : -<span class="lineNum"> 113 </span> : /** Return the term weight of the given query term. -<span class="lineNum"> 114 </span> : * -<span class="lineNum"> 115 </span> : * @param tname The term to look for. -<span class="lineNum"> 116 </span> : * -<span class="lineNum"> 117 </span> : * @exception Xapian::InvalidArgumentError is thrown if the term was -<span class="lineNum"> 118 </span> : * not in the query. -<span class="lineNum"> 119 </span> : */ -<span class="lineNum"> 120 </span> : Xapian::weight get_termweight(const std::string &tname) const; -<span class="lineNum"> 121 </span> : -<span class="lineNum"> 122 </span> : /** The index of the first item in the result which was put into the -<span class="lineNum"> 123 </span> : * MSet. -<span class="lineNum"> 124 </span> : * -<span class="lineNum"> 125 </span> : * This corresponds to the parameter "first" specified in -<span class="lineNum"> 126 </span> : * Xapian::Enquire::get_mset(). A value of 0 corresponds to the -<span class="lineNum"> 127 </span> : * highest result being the first item in the MSet. -<span class="lineNum"> 128 </span> : */ -<span class="lineNum"> 129 </span> : Xapian::doccount get_firstitem() const; -<span class="lineNum"> 130 </span> : -<span class="lineNum"> 131 </span> : /** A lower bound on the number of documents in the database which -<span class="lineNum"> 132 </span> : * match the query. -<span class="lineNum"> 133 </span> : * -<span class="lineNum"> 134 </span> : * This figure takes into account collapsing of duplicates, -<span class="lineNum"> 135 </span> : * and weighting cutoff values. -<span class="lineNum"> 136 </span> : * -<span class="lineNum"> 137 </span> : * This number is usually considerably less than the actual number -<span class="lineNum"> 138 </span> : * of documents which match the query. -<span class="lineNum"> 139 </span> : */ -<span class="lineNum"> 140 </span> : Xapian::doccount get_matches_lower_bound() const; -<span class="lineNum"> 141 </span> : -<span class="lineNum"> 142 </span> : /** An estimate for the number of documents in the database which -<span class="lineNum"> 143 </span> : * match the query. -<span class="lineNum"> 144 </span> : * -<span class="lineNum"> 145 </span> : * This figure takes into account collapsing of duplicates, -<span class="lineNum"> 146 </span> : * and weighting cutoff values. -<span class="lineNum"> 147 </span> : * -<span class="lineNum"> 148 </span> : * This value is returned because there is sometimes a request to -<span class="lineNum"> 149 </span> : * display such information. However, our experience is that -<span class="lineNum"> 150 </span> : * presenting this value to users causes them to worry about the -<span class="lineNum"> 151 </span> : * large number of results, rather than how useful those at the top -<span class="lineNum"> 152 </span> : * of the result set are, and is thus undesirable. -<span class="lineNum"> 153 </span> : */ -<span class="lineNum"> 154 </span> : Xapian::doccount get_matches_estimated() const; -<span class="lineNum"> 155 </span> : -<span class="lineNum"> 156 </span> : /** An upper bound on the number of documents in the database which -<span class="lineNum"> 157 </span> : * match the query. -<span class="lineNum"> 158 </span> : * -<span class="lineNum"> 159 </span> : * This figure takes into account collapsing of duplicates, -<span class="lineNum"> 160 </span> : * and weighting cutoff values. -<span class="lineNum"> 161 </span> : * -<span class="lineNum"> 162 </span> : * This number is usually considerably greater than the actual -<span class="lineNum"> 163 </span> : * number of documents which match the query. -<span class="lineNum"> 164 </span> : */ -<span class="lineNum"> 165 </span> : Xapian::doccount get_matches_upper_bound() const; -<span class="lineNum"> 166 </span> : -<span class="lineNum"> 167 </span> : /** The maximum possible weight in the MSet. -<span class="lineNum"> 168 </span> : * This weight is likely not to be attained in the set of results, -<span class="lineNum"> 169 </span> : * but represents an upper bound on the weight which a document -<span class="lineNum"> 170 </span> : * could attain for the given query. -<span class="lineNum"> 171 </span> : */ -<span class="lineNum"> 172 </span> : Xapian::weight get_max_possible() const; -<span class="lineNum"> 173 </span> : -<span class="lineNum"> 174 </span> : /** The greatest weight which is attained by any document in the -<span class="lineNum"> 175 </span> : * database. -<span class="lineNum"> 176 </span> : * -<span class="lineNum"> 177 </span> : * If firstitem == 0, this is the weight of the first entry in -<span class="lineNum"> 178 </span> : * items. -<span class="lineNum"> 179 </span> : * -<span class="lineNum"> 180 </span> : * If no documents are found by the query, this will be 0. -<span class="lineNum"> 181 </span> : * -<span class="lineNum"> 182 </span> : * Note that calculation of max_attained requires calculation -<span class="lineNum"> 183 </span> : * of at least one result item - therefore, if no items were -<span class="lineNum"> 184 </span> : * requested when the query was performed (by specifying -<span class="lineNum"> 185 </span> : * maxitems = 0 in Xapian::Enquire::get_mset()), this value will be 0. -<span class="lineNum"> 186 </span> : */ -<span class="lineNum"> 187 </span> : Xapian::weight get_max_attained() const; -<span class="lineNum"> 188 </span> : -<span class="lineNum"> 189 </span> : /** The number of items in this MSet */ -<span class="lineNum"> 190 </span> : Xapian::doccount size() const; -<span class="lineNum"> 191 </span> : -<span class="lineNum"> 192 </span> : /** Required to allow use as an STL container. */ -<span class="lineNum"> 193 </span> : Xapian::doccount max_size() const { return size(); } -<span class="lineNum"> 194 </span> : -<span class="lineNum"> 195 </span> : /** Test if this MSet is empty */ -<span class="lineNum"> 196 </span> : bool empty() const; -<span class="lineNum"> 197 </span> : -<span class="lineNum"> 198 </span> : /** Swap the MSet we point to with another */ -<span class="lineNum"> 199 </span> : void swap(MSet & other); -<span class="lineNum"> 200 </span> : -<span class="lineNum"> 201 </span> : /** Iterator for the terms in this MSet */ -<span class="lineNum"> 202 </span> : MSetIterator begin() const; -<span class="lineNum"> 203 </span> : -<span class="lineNum"> 204 </span> : /** End iterator corresponding to begin() */ -<span class="lineNum"> 205 </span> : MSetIterator end() const; -<span class="lineNum"> 206 </span> : -<span class="lineNum"> 207 </span> : /** Iterator pointing to the last element of this MSet */ -<span class="lineNum"> 208 </span> : MSetIterator back() const; -<span class="lineNum"> 209 </span> : -<span class="lineNum"> 210 </span> : /** This returns the document at position i in this MSet object. -<span class="lineNum"> 211 </span> : * -<span class="lineNum"> 212 </span> : * Note that this is not the same as the document at rank i in the -<span class="lineNum"> 213 </span> : * query, unless the "first" parameter to Xapian::Enquire::get_mset -<span class="lineNum"> 214 </span> : * was 0. Rather, it is the document at rank i + first. -<span class="lineNum"> 215 </span> : * -<span class="lineNum"> 216 </span> : * In other words, the offset is into the documents represented by -<span class="lineNum"> 217 </span> : * this object, not into the set of documents matching the query. -<span class="lineNum"> 218 </span> : */ -<span class="lineNum"> 219 </span> : MSetIterator operator[](Xapian::doccount i) const; -<span class="lineNum"> 220 </span> : -<span class="lineNum"> 221 </span> : /// Allow use as an STL container -<span class="lineNum"> 222 </span> : //@{ -<span class="lineNum"> 223 </span> : typedef MSetIterator value_type; // FIXME: not assignable... -<span class="lineNum"> 224 </span> : typedef MSetIterator iterator; -<span class="lineNum"> 225 </span> : typedef MSetIterator const_iterator; -<span class="lineNum"> 226 </span> : typedef MSetIterator & reference; // Hmm -<span class="lineNum"> 227 </span> : typedef MSetIterator & const_reference; -<span class="lineNum"> 228 </span> : typedef MSetIterator * pointer; // Hmm -<span class="lineNum"> 229 </span> : typedef Xapian::doccount_diff difference_type; -<span class="lineNum"> 230 </span> : typedef Xapian::doccount size_type; -<span class="lineNum"> 231 </span> : //@} -<span class="lineNum"> 232 </span> : -<span class="lineNum"> 233 </span> : /// Return a string describing this object. -<span class="lineNum"> 234 </span> : std::string get_description() const; -<span class="lineNum"> 235 </span> : }; -<span class="lineNum"> 236 </span> : -<span class="lineNum"> 237 </span> : /** An iterator pointing to items in an MSet. -<span class="lineNum"> 238 </span> : * This is used for access to individual results of a match. -<span class="lineNum"> 239 </span> : */ -<span class="lineNum"> 240 </span> : class XAPIAN_VISIBILITY_DEFAULT MSetIterator { -<span class="lineNum"> 241 </span> : private: -<span class="lineNum"> 242 </span> : friend class MSet; -<span class="lineNum"> 243 </span> : friend bool operator==(const MSetIterator &a, const MSetIterator &b); -<span class="lineNum"> 244 </span> : friend bool operator!=(const MSetIterator &a, const MSetIterator &b); -<span class="lineNum"> 245 </span> : -<span class="lineNum"> 246 </span> : MSetIterator(Xapian::doccount index_, const MSet & mset_) -<span class="lineNum"> 247 </span> : : index(index_), mset(mset_) { } -<span class="lineNum"> 248 </span> : -<span class="lineNum"> 249 </span> : Xapian::doccount index; -<span class="lineNum"> 250 </span> : MSet mset; -<span class="lineNum"> 251 </span> : -<span class="lineNum"> 252 </span> : public: -<span class="lineNum"> 253 </span> : /** Create an uninitialised iterator; this cannot be used, but is -<span class="lineNum"> 254 </span> : * convenient syntactically. -<span class="lineNum"> 255 </span> : */ -<span class="lineNum"> 256 </span><span class="lineCov"> 3 : MSetIterator() : index(0), mset() { }</span> -<span class="lineNum"> 257 </span> : -<span class="lineNum"> 258 </span><span class="lineCov"> 165 : ~MSetIterator() { }</span> -<span class="lineNum"> 259 </span> : -<span class="lineNum"> 260 </span> : /// Copying is allowed (and is cheap). -<span class="lineNum"> 261 </span><span class="lineCov"> 58 : MSetIterator(const MSetIterator &other) {</span> -<span class="lineNum"> 262 </span><span class="lineCov"> 58 : index = other.index;</span> -<span class="lineNum"> 263 </span><span class="lineCov"> 58 : mset = other.mset;</span> -<span class="lineNum"> 264 </span><span class="lineCov"> 58 : }</span> -<span class="lineNum"> 265 </span> : -<span class="lineNum"> 266 </span> : /// Assignment is allowed (and is cheap). -<span class="lineNum"> 267 </span><span class="lineCov"> 31 : void operator=(const MSetIterator &other) {</span> -<span class="lineNum"> 268 </span><span class="lineCov"> 31 : index = other.index;</span> -<span class="lineNum"> 269 </span><span class="lineCov"> 31 : mset = other.mset;</span> -<span class="lineNum"> 270 </span><span class="lineCov"> 31 : }</span> -<span class="lineNum"> 271 </span> : -<span class="lineNum"> 272 </span> : /// Advance the iterator. -<span class="lineNum"> 273 </span><span class="lineCov"> 61 : MSetIterator & operator++() {</span> -<span class="lineNum"> 274 </span><span class="lineCov"> 61 : ++index;</span> -<span class="lineNum"> 275 </span><span class="lineCov"> 61 : return *this;</span> -<span class="lineNum"> 276 </span> : } -<span class="lineNum"> 277 </span> : -<span class="lineNum"> 278 </span> : /// Advance the iterator (postfix variant). -<span class="lineNum"> 279 </span><span class="lineCov"> 28 : MSetIterator operator++(int) {</span> -<span class="lineNum"> 280 </span><span class="lineCov"> 28 : MSetIterator tmp = *this;</span> -<span class="lineNum"> 281 </span><span class="lineCov"> 28 : ++index;</span> -<span class="lineNum"> 282 </span> : return tmp; -<span class="lineNum"> 283 </span> : } -<span class="lineNum"> 284 </span> : -<span class="lineNum"> 285 </span> : /// Decrement the iterator. -<span class="lineNum"> 286 </span> : MSetIterator & operator--() { -<span class="lineNum"> 287 </span> : --index; -<span class="lineNum"> 288 </span> : return *this; -<span class="lineNum"> 289 </span> : } -<span class="lineNum"> 290 </span> : -<span class="lineNum"> 291 </span> : /// Decrement the iterator (postfix variant). -<span class="lineNum"> 292 </span> : MSetIterator operator--(int) { -<span class="lineNum"> 293 </span> : MSetIterator tmp = *this; -<span class="lineNum"> 294 </span> : --index; -<span class="lineNum"> 295 </span> : return tmp; -<span class="lineNum"> 296 </span> : } -<span class="lineNum"> 297 </span> : -<span class="lineNum"> 298 </span> : /// Get the document ID for the current position. -<span class="lineNum"> 299 </span> : Xapian::docid operator*() const; -<span class="lineNum"> 300 </span> : -<span class="lineNum"> 301 </span> : /** Get a Xapian::Document object for the current position. -<span class="lineNum"> 302 </span> : * -<span class="lineNum"> 303 </span> : * This method returns a Xapian::Document object which provides the -<span class="lineNum"> 304 </span> : * information about the document pointed to by the MSetIterator. -<span class="lineNum"> 305 </span> : * -<span class="lineNum"> 306 </span> : * If the underlying database has suitable support, using this call -<span class="lineNum"> 307 </span> : * (rather than asking the database for a document based on its -<span class="lineNum"> 308 </span> : * document ID) will enable the system to ensure that the correct -<span class="lineNum"> 309 </span> : * data is returned, and that the document has not been deleted -<span class="lineNum"> 310 </span> : * or changed since the query was performed. -<span class="lineNum"> 311 </span> : * -<span class="lineNum"> 312 </span> : * @return A Xapian::Document object containing the document data. -<span class="lineNum"> 313 </span> : * -<span class="lineNum"> 314 </span> : * @exception Xapian::DocNotFoundError The document specified could not -<span class="lineNum"> 315 </span> : * be found in the database. -<span class="lineNum"> 316 </span> : */ -<span class="lineNum"> 317 </span> : Xapian::Document get_document() const; -<span class="lineNum"> 318 </span> : -<span class="lineNum"> 319 </span> : /** Get the rank of the document at the current position. -<span class="lineNum"> 320 </span> : * -<span class="lineNum"> 321 </span> : * The rank is the position that this document is at in the ordered -<span class="lineNum"> 322 </span> : * list of results of the query. The result is 0-based - i.e. the -<span class="lineNum"> 323 </span> : * top-ranked document has a rank of 0. -<span class="lineNum"> 324 </span> : */ -<span class="lineNum"> 325 </span> : Xapian::doccount get_rank() const { -<span class="lineNum"> 326 </span> : return mset.get_firstitem() + index; -<span class="lineNum"> 327 </span> : } -<span class="lineNum"> 328 </span> : -<span class="lineNum"> 329 </span> : /// Get the weight of the document at the current position -<span class="lineNum"> 330 </span> : Xapian::weight get_weight() const; -<span class="lineNum"> 331 </span> : -<span class="lineNum"> 332 </span> : /** Get the collapse key for this document. -<span class="lineNum"> 333 </span> : */ -<span class="lineNum"> 334 </span> : std::string get_collapse_key() const; -<span class="lineNum"> 335 </span> : -<span class="lineNum"> 336 </span> : /** Get an estimate of the number of documents that have been collapsed -<span class="lineNum"> 337 </span> : * into this one. -<span class="lineNum"> 338 </span> : * -<span class="lineNum"> 339 </span> : * The estimate will always be less than or equal to the actual -<span class="lineNum"> 340 </span> : * number of other documents satisfying the match criteria with the -<span class="lineNum"> 341 </span> : * same collapse key as this document. -<span class="lineNum"> 342 </span> : * -<span class="lineNum"> 343 </span> : * This method may return 0 even though there are other documents with -<span class="lineNum"> 344 </span> : * the same collapse key which satisfying the match criteria. However -<span class="lineNum"> 345 </span> : * if this method returns non-zero, there definitely are other such -<span class="lineNum"> 346 </span> : * documents. So this method may be used to inform the user that -<span class="lineNum"> 347 </span> : * there are "at least N other matches in this group", or to control -<span class="lineNum"> 348 </span> : * whether to offer a "show other documents in this group" feature -<span class="lineNum"> 349 </span> : * (but note that it may not offer it in every case where it would -<span class="lineNum"> 350 </span> : * show other documents). -<span class="lineNum"> 351 </span> : */ -<span class="lineNum"> 352 </span> : Xapian::doccount get_collapse_count() const; -<span class="lineNum"> 353 </span> : -<span class="lineNum"> 354 </span> : /** This returns the weight of the document as a percentage score. -<span class="lineNum"> 355 </span> : * -<span class="lineNum"> 356 </span> : * The return value will be in the range 0 to 100: 0 meaning -<span class="lineNum"> 357 </span> : * that the item did not match the query at all. -<span class="lineNum"> 358 </span> : */ -<span class="lineNum"> 359 </span> : Xapian::percent get_percent() const; -<span class="lineNum"> 360 </span> : -<span class="lineNum"> 361 </span> : /// Return a string describing this object. -<span class="lineNum"> 362 </span> : std::string get_description() const; -<span class="lineNum"> 363 </span> : -<span class="lineNum"> 364 </span> : /// Allow use as an STL iterator -<span class="lineNum"> 365 </span> : //@{ -<span class="lineNum"> 366 </span> : typedef std::bidirectional_iterator_tag iterator_category; // FIXME: could enhance to be a randomaccess_iterator -<span class="lineNum"> 367 </span> : typedef Xapian::docid value_type; -<span class="lineNum"> 368 </span> : typedef Xapian::doccount_diff difference_type; -<span class="lineNum"> 369 </span> : typedef Xapian::docid * pointer; -<span class="lineNum"> 370 </span> : typedef Xapian::docid & reference; -<span class="lineNum"> 371 </span> : //@} -<span class="lineNum"> 372 </span> : }; -<span class="lineNum"> 373 </span> : -<span class="lineNum"> 374 </span><span class="lineCov"> 30 : inline bool operator==(const MSetIterator &a, const MSetIterator &b)</span> -<span class="lineNum"> 375 </span> : { -<span class="lineNum"> 376 </span><span class="lineCov"> 30 : return (a.index == b.index);</span> -<span class="lineNum"> 377 </span> : } -<span class="lineNum"> 378 </span> : -<span class="lineNum"> 379 </span><span class="lineCov"> 58 : inline bool operator!=(const MSetIterator &a, const MSetIterator &b)</span> -<span class="lineNum"> 380 </span> : { -<span class="lineNum"> 381 </span><span class="lineCov"> 58 : return (a.index != b.index);</span> -<span class="lineNum"> 382 </span> : } -<span class="lineNum"> 383 </span> : -<span class="lineNum"> 384 </span> : class ESetIterator; -<span class="lineNum"> 385 </span> : -<span class="lineNum"> 386 </span> : /** Class representing an ordered set of expand terms (an ESet). -<span class="lineNum"> 387 </span> : * This set represents the results of an expand operation, which is -<span class="lineNum"> 388 </span> : * performed by Xapian::Enquire::get_eset(). -<span class="lineNum"> 389 </span> : */ -<span class="lineNum"> 390 </span> : class XAPIAN_VISIBILITY_DEFAULT ESet { -<span class="lineNum"> 391 </span> : public: -<span class="lineNum"> 392 </span> : class Internal; -<span class="lineNum"> 393 </span> : /// @internal Reference counted internals. -<span class="lineNum"> 394 </span> : Xapian::Internal::RefCntPtr<Internal> internal; -<span class="lineNum"> 395 </span> : -<span class="lineNum"> 396 </span> : /// Construct an empty ESet -<span class="lineNum"> 397 </span> : ESet(); -<span class="lineNum"> 398 </span> : -<span class="lineNum"> 399 </span> : /// Destructor. -<span class="lineNum"> 400 </span> : ~ESet(); -<span class="lineNum"> 401 </span> : -<span class="lineNum"> 402 </span> : /// Copying is allowed (and is cheap). -<span class="lineNum"> 403 </span> : ESet(const ESet & other); -<span class="lineNum"> 404 </span> : -<span class="lineNum"> 405 </span> : /// Assignment is allowed (and is cheap). -<span class="lineNum"> 406 </span> : void operator=(const ESet &other); -<span class="lineNum"> 407 </span> : -<span class="lineNum"> 408 </span> : /** A lower bound on the number of terms which are in the full -<span class="lineNum"> 409 </span> : * set of results of the expand. This will be greater than or -<span class="lineNum"> 410 </span> : * equal to size() -<span class="lineNum"> 411 </span> : */ -<span class="lineNum"> 412 </span> : Xapian::termcount get_ebound() const; -<span class="lineNum"> 413 </span> : -<span class="lineNum"> 414 </span> : /** The number of terms in this E-Set */ -<span class="lineNum"> 415 </span> : Xapian::termcount size() const; -<span class="lineNum"> 416 </span> : -<span class="lineNum"> 417 </span> : /** Required to allow use as an STL container. */ -<span class="lineNum"> 418 </span> : Xapian::termcount max_size() const { return size(); } -<span class="lineNum"> 419 </span> : -<span class="lineNum"> 420 </span> : /** Test if this E-Set is empty */ -<span class="lineNum"> 421 </span> : bool empty() const; -<span class="lineNum"> 422 </span> : -<span class="lineNum"> 423 </span> : /** Swap the E-Set we point to with another */ -<span class="lineNum"> 424 </span> : void swap(ESet & other); -<span class="lineNum"> 425 </span> : -<span class="lineNum"> 426 </span> : /** Iterator for the terms in this E-Set */ -<span class="lineNum"> 427 </span> : ESetIterator begin() const; -<span class="lineNum"> 428 </span> : -<span class="lineNum"> 429 </span> : /** End iterator corresponding to begin() */ -<span class="lineNum"> 430 </span> : ESetIterator end() const; -<span class="lineNum"> 431 </span> : -<span class="lineNum"> 432 </span> : /** Iterator pointing to the last element of this E-Set */ -<span class="lineNum"> 433 </span> : ESetIterator back() const; -<span class="lineNum"> 434 </span> : -<span class="lineNum"> 435 </span> : /** This returns the term at position i in this E-Set. */ -<span class="lineNum"> 436 </span> : ESetIterator operator[](Xapian::termcount i) const; -<span class="lineNum"> 437 </span> : -<span class="lineNum"> 438 </span> : /// Return a string describing this object. -<span class="lineNum"> 439 </span> : std::string get_description() const; -<span class="lineNum"> 440 </span> : }; -<span class="lineNum"> 441 </span> : -<span class="lineNum"> 442 </span> : /** Iterate through terms in the ESet */ -<span class="lineNum"> 443 </span> : class XAPIAN_VISIBILITY_DEFAULT ESetIterator { -<span class="lineNum"> 444 </span> : private: -<span class="lineNum"> 445 </span> : friend class ESet; -<span class="lineNum"> 446 </span> : friend bool operator==(const ESetIterator &a, const ESetIterator &b); -<span class="lineNum"> 447 </span> : friend bool operator!=(const ESetIterator &a, const ESetIterator &b); -<span class="lineNum"> 448 </span> : -<span class="lineNum"> 449 </span> : ESetIterator(Xapian::termcount index_, const ESet & eset_) -<span class="lineNum"> 450 </span> : : index(index_), eset(eset_) { } -<span class="lineNum"> 451 </span> : -<span class="lineNum"> 452 </span> : Xapian::termcount index; -<span class="lineNum"> 453 </span> : ESet eset; -<span class="lineNum"> 454 </span> : -<span class="lineNum"> 455 </span> : public: -<span class="lineNum"> 456 </span> : /** Create an uninitialised iterator; this cannot be used, but is -<span class="lineNum"> 457 </span> : * convenient syntactically. -<span class="lineNum"> 458 </span> : */ -<span class="lineNum"> 459 </span> : ESetIterator() : index(0), eset() { } -<span class="lineNum"> 460 </span> : -<span class="lineNum"> 461 </span><span class="lineCov"> 8 : ~ESetIterator() { }</span> -<span class="lineNum"> 462 </span> : -<span class="lineNum"> 463 </span> : /// Copying is allowed (and is cheap). -<span class="lineNum"> 464 </span> : ESetIterator(const ESetIterator &other) { -<span class="lineNum"> 465 </span> : index = other.index; -<span class="lineNum"> 466 </span> : eset = other.eset; -<span class="lineNum"> 467 </span> : } -<span class="lineNum"> 468 </span> : -<span class="lineNum"> 469 </span> : /// Assignment is allowed (and is cheap). -<span class="lineNum"> 470 </span> : void operator=(const ESetIterator &other) { -<span class="lineNum"> 471 </span> : index = other.index; -<span class="lineNum"> 472 </span> : eset = other.eset; -<span class="lineNum"> 473 </span> : } -<span class="lineNum"> 474 </span> : -<span class="lineNum"> 475 </span> : /// Advance the iterator. -<span class="lineNum"> 476 </span><span class="lineNoCov"> 0 : ESetIterator & operator++() {</span> -<span class="lineNum"> 477 </span><span class="lineNoCov"> 0 : ++index;</span> -<span class="lineNum"> 478 </span><span class="lineNoCov"> 0 : return *this;</span> -<span class="lineNum"> 479 </span> : } -<span class="lineNum"> 480 </span> : -<span class="lineNum"> 481 </span> : /// Advance the iterator (postfix variant). -<span class="lineNum"> 482 </span> : ESetIterator operator++(int) { -<span class="lineNum"> 483 </span> : ESetIterator tmp = *this; -<span class="lineNum"> 484 </span> : ++index; -<span class="lineNum"> 485 </span> : return tmp; -<span class="lineNum"> 486 </span> : } -<span class="lineNum"> 487 </span> : -<span class="lineNum"> 488 </span> : /// Decrement the iterator. -<span class="lineNum"> 489 </span> : ESetIterator & operator--() { -<span class="lineNum"> 490 </span> : --index; -<span class="lineNum"> 491 </span> : return *this; -<span class="lineNum"> 492 </span> : } -<span class="lineNum"> 493 </span> : -<span class="lineNum"> 494 </span> : /// Decrement the iterator (postfix variant). -<span class="lineNum"> 495 </span> : ESetIterator operator--(int) { -<span class="lineNum"> 496 </span> : ESetIterator tmp = *this; -<span class="lineNum"> 497 </span> : --index; -<span class="lineNum"> 498 </span> : return tmp; -<span class="lineNum"> 499 </span> : } -<span class="lineNum"> 500 </span> : -<span class="lineNum"> 501 </span> : /// Get the term for the current position -<span class="lineNum"> 502 </span> : const std::string & operator *() const; -<span class="lineNum"> 503 </span> : -<span class="lineNum"> 504 </span> : /// Get the weight of the term at the current position -<span class="lineNum"> 505 </span> : Xapian::weight get_weight() const; -<span class="lineNum"> 506 </span> : -<span class="lineNum"> 507 </span> : /// Return a string describing this object. -<span class="lineNum"> 508 </span> : std::string get_description() const; -<span class="lineNum"> 509 </span> : -<span class="lineNum"> 510 </span> : /// Allow use as an STL iterator -<span class="lineNum"> 511 </span> : //@{ -<span class="lineNum"> 512 </span> : typedef std::bidirectional_iterator_tag iterator_category; // FIXME: go for randomaccess_iterator! -<span class="lineNum"> 513 </span> : typedef std::string value_type; -<span class="lineNum"> 514 </span> : typedef Xapian::termcount_diff difference_type; -<span class="lineNum"> 515 </span> : typedef std::string * pointer; -<span class="lineNum"> 516 </span> : typedef std::string & reference; -<span class="lineNum"> 517 </span> : //@} -<span class="lineNum"> 518 </span> : }; -<span class="lineNum"> 519 </span> : -<span class="lineNum"> 520 </span> : inline bool operator==(const ESetIterator &a, const ESetIterator &b) -<span class="lineNum"> 521 </span> : { -<span class="lineNum"> 522 </span> : return (a.index == b.index); -<span class="lineNum"> 523 </span> : } -<span class="lineNum"> 524 </span> : -<span class="lineNum"> 525 </span><span class="lineCov"> 4 : inline bool operator!=(const ESetIterator &a, const ESetIterator &b)</span> -<span class="lineNum"> 526 </span> : { -<span class="lineNum"> 527 </span><span class="lineCov"> 4 : return (a.index != b.index);</span> -<span class="lineNum"> 528 </span> : } -<span class="lineNum"> 529 </span> : -<span class="lineNum"> 530 </span> : /** A relevance set (R-Set). -<span class="lineNum"> 531 </span> : * This is the set of documents which are marked as relevant, for use -<span class="lineNum"> 532 </span> : * in modifying the term weights, and in performing query expansion. -<span class="lineNum"> 533 </span> : */ -<span class="lineNum"> 534 </span> : class XAPIAN_VISIBILITY_DEFAULT RSet { -<span class="lineNum"> 535 </span> : public: -<span class="lineNum"> 536 </span> : /// Class holding details of RSet -<span class="lineNum"> 537 </span> : class Internal; -<span class="lineNum"> 538 </span> : -<span class="lineNum"> 539 </span> : /// @internal Reference counted internals. -<span class="lineNum"> 540 </span> : Xapian::Internal::RefCntPtr<Internal> internal; -<span class="lineNum"> 541 </span> : -<span class="lineNum"> 542 </span> : /// Copy constructor -<span class="lineNum"> 543 </span> : RSet(const RSet &rset); -<span class="lineNum"> 544 </span> : -<span class="lineNum"> 545 </span> : /// Assignment operator -<span class="lineNum"> 546 </span> : void operator=(const RSet &rset); -<span class="lineNum"> 547 </span> : -<span class="lineNum"> 548 </span> : /// Default constructor -<span class="lineNum"> 549 </span> : RSet(); -<span class="lineNum"> 550 </span> : -<span class="lineNum"> 551 </span> : /// Destructor -<span class="lineNum"> 552 </span> : ~RSet(); -<span class="lineNum"> 553 </span> : -<span class="lineNum"> 554 </span> : /** The number of documents in this R-Set */ -<span class="lineNum"> 555 </span> : Xapian::doccount size() const; -<span class="lineNum"> 556 </span> : -<span class="lineNum"> 557 </span> : /** Test if this R-Set is empty */ -<span class="lineNum"> 558 </span> : bool empty() const; -<span class="lineNum"> 559 </span> : -<span class="lineNum"> 560 </span> : /// Add a document to the relevance set. -<span class="lineNum"> 561 </span> : void add_document(Xapian::docid did); -<span class="lineNum"> 562 </span> : -<span class="lineNum"> 563 </span> : /// Add a document to the relevance set. -<span class="lineNum"> 564 </span><span class="lineCov"> 20 : void add_document(const Xapian::MSetIterator & i) { add_document(*i); }</span> -<span class="lineNum"> 565 </span> : -<span class="lineNum"> 566 </span> : /// Remove a document from the relevance set. -<span class="lineNum"> 567 </span> : void remove_document(Xapian::docid did); -<span class="lineNum"> 568 </span> : -<span class="lineNum"> 569 </span> : /// Remove a document from the relevance set. -<span class="lineNum"> 570 </span> : void remove_document(const Xapian::MSetIterator & i) { remove_document(*i); } -<span class="lineNum"> 571 </span> : -<span class="lineNum"> 572 </span> : /// Test if a given document in the relevance set. -<span class="lineNum"> 573 </span> : bool contains(Xapian::docid did) const; -<span class="lineNum"> 574 </span> : -<span class="lineNum"> 575 </span> : /// Test if a given document in the relevance set. -<span class="lineNum"> 576 </span> : bool contains(const Xapian::MSetIterator & i) const { return contains(*i); } -<span class="lineNum"> 577 </span> : -<span class="lineNum"> 578 </span> : /// Return a string describing this object. -<span class="lineNum"> 579 </span> : std::string get_description() const; -<span class="lineNum"> 580 </span> : }; -<span class="lineNum"> 581 </span> : -<span class="lineNum"> 582 </span> : /** Base class for matcher decision functor. -<span class="lineNum"> 583 </span> : */ -<span class="lineNum"> 584 </span> : class XAPIAN_VISIBILITY_DEFAULT MatchDecider { -<span class="lineNum"> 585 </span> : public: -<span class="lineNum"> 586 </span> : /** Decide whether we want this document to be in the MSet. -<span class="lineNum"> 587 </span> : * -<span class="lineNum"> 588 </span> : * Return true if the document is acceptable, or false if the document -<span class="lineNum"> 589 </span> : * should be excluded from the MSet. -<span class="lineNum"> 590 </span> : */ -<span class="lineNum"> 591 </span> : virtual bool operator()(const Xapian::Document &doc) const = 0; -<span class="lineNum"> 592 </span> : -<span class="lineNum"> 593 </span> : /// Destructor. -<span class="lineNum"> 594 </span> : virtual ~MatchDecider(); -<span class="lineNum"> 595 </span> : }; -<span class="lineNum"> 596 </span> : -<span class="lineNum"> 597 </span> : /** This class provides an interface to the information retrieval -<span class="lineNum"> 598 </span> : * system for the purpose of searching. -<span class="lineNum"> 599 </span> : * -<span class="lineNum"> 600 </span> : * Databases are usually opened lazily, so exceptions may not be -<span class="lineNum"> 601 </span> : * thrown where you would expect them to be. You should catch -<span class="lineNum"> 602 </span> : * Xapian::Error exceptions when calling any method in Xapian::Enquire. -<span class="lineNum"> 603 </span> : * -<span class="lineNum"> 604 </span> : * @exception Xapian::InvalidArgumentError will be thrown if an invalid -<span class="lineNum"> 605 </span> : * argument is supplied, for example, an unknown database type. -<span class="lineNum"> 606 </span> : */ -<span class="lineNum"> 607 </span> : class XAPIAN_VISIBILITY_DEFAULT Enquire { -<span class="lineNum"> 608 </span> : public: -<span class="lineNum"> 609 </span> : /// Copying is allowed (and is cheap). -<span class="lineNum"> 610 </span> : Enquire(const Enquire & other); -<span class="lineNum"> 611 </span> : -<span class="lineNum"> 612 </span> : /// Assignment is allowed (and is cheap). -<span class="lineNum"> 613 </span> : void operator=(const Enquire & other); -<span class="lineNum"> 614 </span> : -<span class="lineNum"> 615 </span> : class Internal; -<span class="lineNum"> 616 </span> : /// @internal Reference counted internals. -<span class="lineNum"> 617 </span> : Xapian::Internal::RefCntPtr<Internal> internal; -<span class="lineNum"> 618 </span> : -<span class="lineNum"> 619 </span> : /** Create a Xapian::Enquire object. -<span class="lineNum"> 620 </span> : * -<span class="lineNum"> 621 </span> : * This specification cannot be changed once the Xapian::Enquire is -<span class="lineNum"> 622 </span> : * opened: you must create a new Xapian::Enquire object to access a -<span class="lineNum"> 623 </span> : * different database, or set of databases. -<span class="lineNum"> 624 </span> : * -<span class="lineNum"> 625 </span> : * The database supplied must have been initialised (ie, must not be -<span class="lineNum"> 626 </span> : * the result of calling the Database::Database() constructor). If -<span class="lineNum"> 627 </span> : * you need to handle a situation where you have no index gracefully, -<span class="lineNum"> 628 </span> : * a database created with InMemory::open() can be passed here, -<span class="lineNum"> 629 </span> : * which represents a completely empty database. -<span class="lineNum"> 630 </span> : * -<span class="lineNum"> 631 </span> : * @param database Specification of the database or databases to -<span class="lineNum"> 632 </span> : * use. -<span class="lineNum"> 633 </span> : * @param errorhandler_ A pointer to the error handler to use. -<span class="lineNum"> 634 </span> : * Ownership of the object pointed to is not assumed by the -<span class="lineNum"> 635 </span> : * Xapian::Enquire object - the user should delete the -<span class="lineNum"> 636 </span> : * Xapian::ErrorHandler object after the Xapian::Enquire object -<span class="lineNum"> 637 </span> : * is deleted. To use no error handler, this parameter -<span class="lineNum"> 638 </span> : * should be 0. -<span class="lineNum"> 639 </span> : * -<span class="lineNum"> 640 </span> : * @exception Xapian::InvalidArgumentError will be thrown if an -<span class="lineNum"> 641 </span> : * initialised Database object is supplied. -<span class="lineNum"> 642 </span> : */ -<span class="lineNum"> 643 </span> : explicit Enquire(const Database &database, ErrorHandler * errorhandler_ = 0); -<span class="lineNum"> 644 </span> : -<span class="lineNum"> 645 </span> : /** Close the Xapian::Enquire object. -<span class="lineNum"> 646 </span> : */ -<span class="lineNum"> 647 </span> : ~Enquire(); -<span class="lineNum"> 648 </span> : -<span class="lineNum"> 649 </span> : /** Set the query to run. -<span class="lineNum"> 650 </span> : * -<span class="lineNum"> 651 </span> : * @param query the new query to run. -<span class="lineNum"> 652 </span> : * @param qlen the query length to use in weight calculations - -<span class="lineNum"> 653 </span> : * by default the sum of the wqf of all terms is used. -<span class="lineNum"> 654 </span> : */ -<span class="lineNum"> 655 </span> : void set_query(const Xapian::Query & query, Xapian::termcount qlen = 0); -<span class="lineNum"> 656 </span> : -<span class="lineNum"> 657 </span> : /** Get the query which has been set. -<span class="lineNum"> 658 </span> : * This is only valid after set_query() has been called. -<span class="lineNum"> 659 </span> : * -<span class="lineNum"> 660 </span> : * @exception Xapian::InvalidArgumentError will be thrown if query has -<span class="lineNum"> 661 </span> : * not yet been set. -<span class="lineNum"> 662 </span> : */ -<span class="lineNum"> 663 </span> : const Xapian::Query & get_query() const; -<span class="lineNum"> 664 </span> : -<span class="lineNum"> 665 </span> : /** Set the weighting scheme to use for queries. -<span class="lineNum"> 666 </span> : * -<span class="lineNum"> 667 </span> : * @param weight_ the new weighting scheme. If no weighting scheme -<span class="lineNum"> 668 </span> : * is specified, the default is BM25 with the -<span class="lineNum"> 669 </span> : * default parameters. -<span class="lineNum"> 670 </span> : */ -<span class="lineNum"> 671 </span> : void set_weighting_scheme(const Weight &weight_); -<span class="lineNum"> 672 </span> : -<span class="lineNum"> 673 </span> : /** Set the collapse key to use for queries. -<span class="lineNum"> 674 </span> : * -<span class="lineNum"> 675 </span> : * @param collapse_key value number to collapse on - at most one MSet -<span class="lineNum"> 676 </span> : * entry with each particular value will be returned. -<span class="lineNum"> 677 </span> : * -<span class="lineNum"> 678 </span> : * The entry returned will be the best entry with that particular -<span class="lineNum"> 679 </span> : * value (highest weight or highest sorting key). -<span class="lineNum"> 680 </span> : * -<span class="lineNum"> 681 </span> : * An example use might be to create a value for each document -<span class="lineNum"> 682 </span> : * containing an MD5 hash of the document contents. Then -<span class="lineNum"> 683 </span> : * duplicate documents from different sources can be eliminated at -<span class="lineNum"> 684 </span> : * search time (it's better to eliminate duplicates at index time, -<span class="lineNum"> 685 </span> : * but this may not be always be possible - for example the search -<span class="lineNum"> 686 </span> : * may be over more than one Xapian database). -<span class="lineNum"> 687 </span> : * -<span class="lineNum"> 688 </span> : * Another use is to group matches in a particular category (e.g. -<span class="lineNum"> 689 </span> : * you might collapse a mailing list search on the Subject: so -<span class="lineNum"> 690 </span> : * that there's only one result per discussion thread). In this -<span class="lineNum"> 691 </span> : * case you can use get_collapse_count() to give the user some -<span class="lineNum"> 692 </span> : * idea how many other results there are. And if you index the -<span class="lineNum"> 693 </span> : * Subject: as a boolean term as well as putting it in a value, -<span class="lineNum"> 694 </span> : * you can offer a link to a non-collapsed search restricted to -<span class="lineNum"> 695 </span> : * that thread using a boolean filter. -<span class="lineNum"> 696 </span> : * -<span class="lineNum"> 697 </span> : * (default is Xapian::BAD_VALUENO which means no collapsing). -<span class="lineNum"> 698 </span> : */ -<span class="lineNum"> 699 </span> : void set_collapse_key(Xapian::valueno collapse_key); -<span class="lineNum"> 700 </span> : -<span class="lineNum"> 701 </span> : typedef enum { -<span class="lineNum"> 702 </span> : ASCENDING = 1, -<span class="lineNum"> 703 </span> : DESCENDING = 0, -<span class="lineNum"> 704 </span> : DONT_CARE = 2 -<span class="lineNum"> 705 </span> : } docid_order; -<span class="lineNum"> 706 </span> : -<span class="lineNum"> 707 </span> : /** Set the direction in which documents are ordered by document id -<span class="lineNum"> 708 </span> : * in the returned MSet. -<span class="lineNum"> 709 </span> : * -<span class="lineNum"> 710 </span> : * This order only has an effect on documents which would otherwise -<span class="lineNum"> 711 </span> : * have equal rank. For a weighted probabilistic match with no sort -<span class="lineNum"> 712 </span> : * value, this means documents with equal weight. For a boolean match, -<span class="lineNum"> 713 </span> : * with no sort value, this means all documents. And if a sort value -<span class="lineNum"> 714 </span> : * is used, this means documents with equal sort value (and also equal -<span class="lineNum"> 715 </span> : * weight if ordering on relevance after the sort). -<span class="lineNum"> 716 </span> : * -<span class="lineNum"> 717 </span> : * @param order This can be: -<span class="lineNum"> 718 </span> : * - Xapian::Enquire::ASCENDING -<span class="lineNum"> 719 </span> : * docids sort in ascending order (default) -<span class="lineNum"> 720 </span> : * - Xapian::Enquire::DESCENDING -<span class="lineNum"> 721 </span> : * docids sort in descending order -<span class="lineNum"> 722 </span> : * - Xapian::Enquire::DONT_CARE -<span class="lineNum"> 723 </span> : * docids sort in whatever order is most efficient for the backend -<span class="lineNum"> 724 </span> : * -<span class="lineNum"> 725 </span> : * Note: If you add documents in strict date order, then a boolean -<span class="lineNum"> 726 </span> : * search - i.e. set_weighting_scheme(Xapian::BoolWeight()) - with -<span class="lineNum"> 727 </span> : * set_docid_order(Xapian::Enquire::DESCENDING) is a very efficient -<span class="lineNum"> 728 </span> : * way to perform "sort by date, newest first". -<span class="lineNum"> 729 </span> : */ -<span class="lineNum"> 730 </span> : void set_docid_order(docid_order order); -<span class="lineNum"> 731 </span> : -<span class="lineNum"> 732 </span> : /** Set the percentage and/or weight cutoffs. -<span class="lineNum"> 733 </span> : * -<span class="lineNum"> 734 </span> : * @param percent_cutoff Minimum percentage score for returned -<span class="lineNum"> 735 </span> : * documents. If a document has a lower percentage score than this, -<span class="lineNum"> 736 </span> : * it will not appear in the MSet. If your intention is to return -<span class="lineNum"> 737 </span> : * only matches which contain all the terms in the query, then -<span class="lineNum"> 738 </span> : * it's more efficient to use Xapian::Query::OP_AND instead of -<span class="lineNum"> 739 </span> : * Xapian::Query::OP_OR in the query than to use set_cutoff(100). -<span class="lineNum"> 740 </span> : * (default 0 => no percentage cut-off). -<span class="lineNum"> 741 </span> : * @param weight_cutoff Minimum weight for a document to be returned. -<span class="lineNum"> 742 </span> : * If a document has a lower score that this, it will not appear -<span class="lineNum"> 743 </span> : * in the MSet. It is usually only possible to choose an -<span class="lineNum"> 744 </span> : * appropriate weight for cutoff based on the results of a -<span class="lineNum"> 745 </span> : * previous run of the same query; this is thus mainly useful for -<span class="lineNum"> 746 </span> : * alerting operations. The other potential use is with a user -<span class="lineNum"> 747 </span> : * specified weighting scheme. -<span class="lineNum"> 748 </span> : * (default 0 => no weight cut-off). -<span class="lineNum"> 749 </span> : */ -<span class="lineNum"> 750 </span> : void set_cutoff(Xapian::percent percent_cutoff, Xapian::weight weight_cutoff = 0); -<span class="lineNum"> 751 </span> : -<span class="lineNum"> 752 </span> : /** Set the sorting to be by relevance only. -<span class="lineNum"> 753 </span> : * -<span class="lineNum"> 754 </span> : * This is the default. -<span class="lineNum"> 755 </span> : */ -<span class="lineNum"> 756 </span> : void set_sort_by_relevance(); -<span class="lineNum"> 757 </span> : -<span class="lineNum"> 758 </span> : /** Set the sorting to be by value only. -<span class="lineNum"> 759 </span> : * -<span class="lineNum"> 760 </span> : * NB sorting of values uses a string comparison, so you'll need to -<span class="lineNum"> 761 </span> : * store numbers padded with leading zeros or spaces, or with the -<span class="lineNum"> 762 </span> : * number of digits prepended. -<span class="lineNum"> 763 </span> : * -<span class="lineNum"> 764 </span> : * @param sort_key value number to sort on. -<span class="lineNum"> 765 </span> : * -<span class="lineNum"> 766 </span> : * @param ascending If true, documents values which sort higher by -<span class="lineNum"> 767 </span> : * string compare are better. If false, the sort order -<span class="lineNum"> 768 </span> : * is reversed. (default true) -<span class="lineNum"> 769 </span> : */ -<span class="lineNum"> 770 </span> : void set_sort_by_value(Xapian::valueno sort_key, bool ascending = true); -<span class="lineNum"> 771 </span> : -<span class="lineNum"> 772 </span> : /** Set the sorting to be by key generated from values only. -<span class="lineNum"> 773 </span> : * -<span class="lineNum"> 774 </span> : * @param sorter The functor to use for generating keys. -<span class="lineNum"> 775 </span> : * -<span class="lineNum"> 776 </span> : * @param ascending If true, documents values which sort higher by -<span class="lineNum"> 777 </span> : * string compare are better. If false, the sort order -<span class="lineNum"> 778 </span> : * is reversed. (default true) -<span class="lineNum"> 779 </span> : */ -<span class="lineNum"> 780 </span> : void set_sort_by_key(Xapian::Sorter * sorter, bool ascending = true); -<span class="lineNum"> 781 </span> : -<span class="lineNum"> 782 </span> : /** Set the sorting to be by value, then by relevance for documents -<span class="lineNum"> 783 </span> : * with the same value. -<span class="lineNum"> 784 </span> : * -<span class="lineNum"> 785 </span> : * NB sorting of values uses a string comparison, so you'll need to -<span class="lineNum"> 786 </span> : * store numbers padded with leading zeros or spaces, or with the -<span class="lineNum"> 787 </span> : * number of digits prepended. -<span class="lineNum"> 788 </span> : * -<span class="lineNum"> 789 </span> : * @param sort_key value number to sort on. -<span class="lineNum"> 790 </span> : * -<span class="lineNum"> 791 </span> : * @param ascending If true, documents values which sort higher by -<span class="lineNum"> 792 </span> : * string compare are better. If false, the sort order -<span class="lineNum"> 793 </span> : * is reversed. (default true) -<span class="lineNum"> 794 </span> : */ -<span class="lineNum"> 795 </span> : void set_sort_by_value_then_relevance(Xapian::valueno sort_key, -<span class="lineNum"> 796 </span> : bool ascending = true); -<span class="lineNum"> 797 </span> : -<span class="lineNum"> 798 </span> : /** Set the sorting to be by keys generated from values, then by -<span class="lineNum"> 799 </span> : * relevance for documents with identical keys. -<span class="lineNum"> 800 </span> : * -<span class="lineNum"> 801 </span> : * @param sorter The functor to use for generating keys. -<span class="lineNum"> 802 </span> : * -<span class="lineNum"> 803 </span> : * @param ascending If true, keys which sort higher by -<span class="lineNum"> 804 </span> : * string compare are better. If false, the sort order -<span class="lineNum"> 805 </span> : * is reversed. (default true) -<span class="lineNum"> 806 </span> : */ -<span class="lineNum"> 807 </span> : void set_sort_by_key_then_relevance(Xapian::Sorter * sorter, -<span class="lineNum"> 808 </span> : bool ascending = true); -<span class="lineNum"> 809 </span> : -<span class="lineNum"> 810 </span> : /** Set the sorting to be by relevance then value. -<span class="lineNum"> 811 </span> : * -<span class="lineNum"> 812 </span> : * NB sorting of values uses a string comparison, so you'll need to -<span class="lineNum"> 813 </span> : * store numbers padded with leading zeros or spaces, or with the -<span class="lineNum"> 814 </span> : * number of digits prepended. -<span class="lineNum"> 815 </span> : * -<span class="lineNum"> 816 </span> : * Note that with the default BM25 weighting scheme parameters, -<span class="lineNum"> 817 </span> : * non-identical documents will rarely have the same weight, so -<span class="lineNum"> 818 </span> : * this setting will give very similar results to -<span class="lineNum"> 819 </span> : * set_sort_by_relevance(). It becomes more useful with particular -<span class="lineNum"> 820 </span> : * BM25 parameter settings (e.g. BM25Weight(1,0,1,0,0)) or custom -<span class="lineNum"> 821 </span> : * weighting schemes. -<span class="lineNum"> 822 </span> : * -<span class="lineNum"> 823 </span> : * @param sort_key value number to sort on. -<span class="lineNum"> 824 </span> : * -<span class="lineNum"> 825 </span> : * @param ascending If true, documents values which sort higher by -<span class="lineNum"> 826 </span> : * string compare are better. If false, the sort order -<span class="lineNum"> 827 </span> : * is reversed. (default true) -<span class="lineNum"> 828 </span> : */ -<span class="lineNum"> 829 </span> : void set_sort_by_relevance_then_value(Xapian::valueno sort_key, -<span class="lineNum"> 830 </span> : bool ascending = true); -<span class="lineNum"> 831 </span> : -<span class="lineNum"> 832 </span> : /** Set the sorting to be by relevance, then by keys generated from -<span class="lineNum"> 833 </span> : * values. -<span class="lineNum"> 834 </span> : * -<span class="lineNum"> 835 </span> : * Note that with the default BM25 weighting scheme parameters, -<span class="lineNum"> 836 </span> : * non-identical documents will rarely have the same weight, so -<span class="lineNum"> 837 </span> : * this setting will give very similar results to -<span class="lineNum"> 838 </span> : * set_sort_by_relevance(). It becomes more useful with particular -<span class="lineNum"> 839 </span> : * BM25 parameter settings (e.g. BM25Weight(1,0,1,0,0)) or custom -<span class="lineNum"> 840 </span> : * weighting schemes. -<span class="lineNum"> 841 </span> : * -<span class="lineNum"> 842 </span> : * @param sorter The functor to use for generating keys. -<span class="lineNum"> 843 </span> : * -<span class="lineNum"> 844 </span> : * @param ascending If true, keys which sort higher by -<span class="lineNum"> 845 </span> : * string compare are better. If false, the sort order -<span class="lineNum"> 846 </span> : * is reversed. (default true) -<span class="lineNum"> 847 </span> : */ -<span class="lineNum"> 848 </span> : void set_sort_by_relevance_then_key(Xapian::Sorter * sorter, -<span class="lineNum"> 849 </span> : bool ascending = true); -<span class="lineNum"> 850 </span> : -<span class="lineNum"> 851 </span> : /** Get (a portion of) the match set for the current query. -<span class="lineNum"> 852 </span> : * -<span class="lineNum"> 853 </span> : * @param first the first item in the result set to return. -<span class="lineNum"> 854 </span> : * A value of zero corresponds to the first item -<span class="lineNum"> 855 </span> : * returned being that with the highest score. -<span class="lineNum"> 856 </span> : * A value of 10 corresponds to the first 10 items -<span class="lineNum"> 857 </span> : * being ignored, and the returned items starting -<span class="lineNum"> 858 </span> : * at the eleventh. -<span class="lineNum"> 859 </span> : * @param maxitems the maximum number of items to return. -<span class="lineNum"> 860 </span> : * @param checkatleast the minimum number of items to check. Because -<span class="lineNum"> 861 </span> : * the matcher optimises, it won't consider every -<span class="lineNum"> 862 </span> : * document which might match, so the total number -<span class="lineNum"> 863 </span> : * of matches is estimated. Setting checkatleast -<span class="lineNum"> 864 </span> : * forces it to consider at least this many matches -<span class="lineNum"> 865 </span> : * and so allows for reliable paging links. -<span class="lineNum"> 866 </span> : * @param omrset the relevance set to use when performing the query. -<span class="lineNum"> 867 </span> : * @param mdecider a decision functor to use to decide whether a -<span class="lineNum"> 868 </span> : * given document should be put in the MSet. -<span class="lineNum"> 869 </span> : * @param matchspy a decision functor to use to decide whether a -<span class="lineNum"> 870 </span> : * given document should be put in the MSet. The -<span class="lineNum"> 871 </span> : * matchspy is applied to every document which is -<span class="lineNum"> 872 </span> : * a potential candidate for the MSet, so if there are -<span class="lineNum"> 873 </span> : * checkatleast or more such documents, the matchspy -<span class="lineNum"> 874 </span> : * will see at least checkatleast. The mdecider is -<span class="lineNum"> 875 </span> : * assumed to be a relatively expensive test so may -<span class="lineNum"> 876 </span> : * be applied in a lazier fashion. -<span class="lineNum"> 877 </span> : * -<span class="lineNum"> 878 </span> : * @return A Xapian::MSet object containing the results of the -<span class="lineNum"> 879 </span> : * query. -<span class="lineNum"> 880 </span> : * -<span class="lineNum"> 881 </span> : * @exception Xapian::InvalidArgumentError See class documentation. -<span class="lineNum"> 882 </span> : */ -<span class="lineNum"> 883 </span> : MSet get_mset(Xapian::doccount first, Xapian::doccount maxitems, -<span class="lineNum"> 884 </span> : Xapian::doccount checkatleast = 0, -<span class="lineNum"> 885 </span> : const RSet * omrset = 0, -<span class="lineNum"> 886 </span> : const MatchDecider * mdecider = 0) const; -<span class="lineNum"> 887 </span> : MSet get_mset(Xapian::doccount first, Xapian::doccount maxitems, -<span class="lineNum"> 888 </span> : Xapian::doccount checkatleast, -<span class="lineNum"> 889 </span> : const RSet * omrset, -<span class="lineNum"> 890 </span> : const MatchDecider * mdecider, -<span class="lineNum"> 891 </span> : const MatchDecider * matchspy) const; -<span class="lineNum"> 892 </span> : MSet get_mset(Xapian::doccount first, Xapian::doccount maxitems, -<span class="lineNum"> 893 </span> : const RSet * omrset, -<span class="lineNum"> 894 </span> : const MatchDecider * mdecider = 0) const { -<span class="lineNum"> 895 </span> : return get_mset(first, maxitems, 0, omrset, mdecider); -<span class="lineNum"> 896 </span> : } -<span class="lineNum"> 897 </span> : -<span class="lineNum"> 898 </span> : static const int INCLUDE_QUERY_TERMS = 1; -<span class="lineNum"> 899 </span> : static const int USE_EXACT_TERMFREQ = 2; -<span class="lineNum"> 900 </span> : #ifndef _MSC_VER -<span class="lineNum"> 901 </span> : /// Deprecated in Xapian 1.0.0, use INCLUDE_QUERY_TERMS instead. -<span class="lineNum"> 902 </span> : XAPIAN_DEPRECATED(static const int include_query_terms) = 1; -<span class="lineNum"> 903 </span> : /// Deprecated in Xapian 1.0.0, use USE_EXACT_TERMFREQ instead. -<span class="lineNum"> 904 </span> : XAPIAN_DEPRECATED(static const int use_exact_termfreq) = 2; -<span class="lineNum"> 905 </span> : #else -<span class="lineNum"> 906 </span> : // Work around MSVC stupidity (you get a warning for deprecating a -<span class="lineNum"> 907 </span> : // declaration). -<span class="lineNum"> 908 </span> : static const int include_query_terms = 1; -<span class="lineNum"> 909 </span> : static const int use_exact_termfreq = 2; -<span class="lineNum"> 910 </span> : #pragma deprecated("Xapian::Enquire::include_query_terms", "Xapian::Enquire::use_exact_termfreq") -<span class="lineNum"> 911 </span> : #endif -<span class="lineNum"> 912 </span> : -<span class="lineNum"> 913 </span> : /** Get the expand set for the given rset. -<span class="lineNum"> 914 </span> : * -<span class="lineNum"> 915 </span> : * @param maxitems the maximum number of items to return. -<span class="lineNum"> 916 </span> : * @param omrset the relevance set to use when performing -<span class="lineNum"> 917 </span> : * the expand operation. -<span class="lineNum"> 918 </span> : * @param flags zero or more of these values |-ed together: -<span class="lineNum"> 919 </span> : * - Xapian::Enquire::INCLUDE_QUERY_TERMS query -<span class="lineNum"> 920 </span> : * terms may be returned from expand -<span class="lineNum"> 921 </span> : * - Xapian::Enquire::USE_EXACT_TERMFREQ for multi -<span class="lineNum"> 922 </span> : * dbs, calculate the exact termfreq; otherwise an -<span class="lineNum"> 923 </span> : * approximation is used which can greatly improve -<span class="lineNum"> 924 </span> : * efficiency, but still returns good results. -<span class="lineNum"> 925 </span> : * @param k the parameter k in the query expansion algorithm -<span class="lineNum"> 926 </span> : * (default is 1.0) -<span class="lineNum"> 927 </span> : * @param edecider a decision functor to use to decide whether a -<span class="lineNum"> 928 </span> : * given term should be put in the ESet -<span class="lineNum"> 929 </span> : * -<span class="lineNum"> 930 </span> : * @return An ESet object containing the results of the -<span class="lineNum"> 931 </span> : * expand. -<span class="lineNum"> 932 </span> : * -<span class="lineNum"> 933 </span> : * @exception Xapian::InvalidArgumentError See class documentation. -<span class="lineNum"> 934 </span> : */ -<span class="lineNum"> 935 </span> : ESet get_eset(Xapian::termcount maxitems, -<span class="lineNum"> 936 </span> : const RSet & omrset, -<span class="lineNum"> 937 </span> : int flags = 0, -<span class="lineNum"> 938 </span> : double k = 1.0, -<span class="lineNum"> 939 </span> : const Xapian::ExpandDecider * edecider = 0) const; -<span class="lineNum"> 940 </span> : -<span class="lineNum"> 941 </span> : /** Get the expand set for the given rset. -<span class="lineNum"> 942 </span> : * -<span class="lineNum"> 943 </span> : * @param maxitems the maximum number of items to return. -<span class="lineNum"> 944 </span> : * @param omrset the relevance set to use when performing -<span class="lineNum"> 945 </span> : * the expand operation. -<span class="lineNum"> 946 </span> : * @param edecider a decision functor to use to decide whether a -<span class="lineNum"> 947 </span> : * given term should be put in the ESet -<span class="lineNum"> 948 </span> : * -<span class="lineNum"> 949 </span> : * @return An ESet object containing the results of the -<span class="lineNum"> 950 </span> : * expand. -<span class="lineNum"> 951 </span> : * -<span class="lineNum"> 952 </span> : * @exception Xapian::InvalidArgumentError See class documentation. -<span class="lineNum"> 953 </span> : */ -<span class="lineNum"> 954 </span> : inline ESet get_eset(Xapian::termcount maxitems, const RSet & omrset, -<span class="lineNum"> 955 </span><span class="lineCov"> 4 : const Xapian::ExpandDecider * edecider) const {</span> -<span class="lineNum"> 956 </span><span class="lineCov"> 4 : return get_eset(maxitems, omrset, 0, 1.0, edecider);</span> -<span class="lineNum"> 957 </span> : } -<span class="lineNum"> 958 </span> : -<span class="lineNum"> 959 </span> : /** Get terms which match a given document, by document id. -<span class="lineNum"> 960 </span> : * -<span class="lineNum"> 961 </span> : * This method returns the terms in the current query which match -<span class="lineNum"> 962 </span> : * the given document. -<span class="lineNum"> 963 </span> : * -<span class="lineNum"> 964 </span> : * It is possible for the document to have been removed from the -<span class="lineNum"> 965 </span> : * database between the time it is returned in an MSet, and the -<span class="lineNum"> 966 </span> : * time that this call is made. If possible, you should specify -<span class="lineNum"> 967 </span> : * an MSetIterator instead of a Xapian::docid, since this will enable -<span class="lineNum"> 968 </span> : * database backends with suitable support to prevent this -<span class="lineNum"> 969 </span> : * occurring. -<span class="lineNum"> 970 </span> : * -<span class="lineNum"> 971 </span> : * Note that a query does not need to have been run in order to -<span class="lineNum"> 972 </span> : * make this call. -<span class="lineNum"> 973 </span> : * -<span class="lineNum"> 974 </span> : * @param did The document id for which to retrieve the matching -<span class="lineNum"> 975 </span> : * terms. -<span class="lineNum"> 976 </span> : * -<span class="lineNum"> 977 </span> : * @return An iterator returning the terms which match the -<span class="lineNum"> 978 </span> : * document. The terms will be returned (as far as this -<span class="lineNum"> 979 </span> : * makes any sense) in the same order as the terms -<span class="lineNum"> 980 </span> : * in the query. Terms will not occur more than once, -<span class="lineNum"> 981 </span> : * even if they do in the query. -<span class="lineNum"> 982 </span> : * -<span class="lineNum"> 983 </span> : * @exception Xapian::InvalidArgumentError See class documentation. -<span class="lineNum"> 984 </span> : * @exception Xapian::DocNotFoundError The document specified -<span class="lineNum"> 985 </span> : * could not be found in the database. -<span class="lineNum"> 986 </span> : */ -<span class="lineNum"> 987 </span> : TermIterator get_matching_terms_begin(Xapian::docid did) const; -<span class="lineNum"> 988 </span> : -<span class="lineNum"> 989 </span> : /** End iterator corresponding to get_matching_terms_begin() */ -<span class="lineNum"> 990 </span> : TermIterator get_matching_terms_end(Xapian::docid /*did*/) const { -<span class="lineNum"> 991 </span> : return TermIterator(NULL); -<span class="lineNum"> 992 </span> : } -<span class="lineNum"> 993 </span> : -<span class="lineNum"> 994 </span> : /** Get terms which match a given document, by match set item. -<span class="lineNum"> 995 </span> : * -<span class="lineNum"> 996 </span> : * This method returns the terms in the current query which match -<span class="lineNum"> 997 </span> : * the given document. -<span class="lineNum"> 998 </span> : * -<span class="lineNum"> 999 </span> : * If the underlying database has suitable support, using this call -<span class="lineNum"> 1000 </span> : * (rather than passing a Xapian::docid) will enable the system to -<span class="lineNum"> 1001 </span> : * ensure that the correct data is returned, and that the document -<span class="lineNum"> 1002 </span> : * has not been deleted or changed since the query was performed. -<span class="lineNum"> 1003 </span> : * -<span class="lineNum"> 1004 </span> : * @param it The iterator for which to retrieve the matching terms. -<span class="lineNum"> 1005 </span> : * -<span class="lineNum"> 1006 </span> : * @return An iterator returning the terms which match the -<span class="lineNum"> 1007 </span> : * document. The terms will be returned (as far as this -<span class="lineNum"> 1008 </span> : * makes any sense) in the same order as the terms -<span class="lineNum"> 1009 </span> : * in the query. Terms will not occur more than once, -<span class="lineNum"> 1010 </span> : * even if they do in the query. -<span class="lineNum"> 1011 </span> : * -<span class="lineNum"> 1012 </span> : * @exception Xapian::InvalidArgumentError See class documentation. -<span class="lineNum"> 1013 </span> : * @exception Xapian::DocNotFoundError The document specified -<span class="lineNum"> 1014 </span> : * could not be found in the database. -<span class="lineNum"> 1015 </span> : */ -<span class="lineNum"> 1016 </span> : TermIterator get_matching_terms_begin(const MSetIterator &it) const; -<span class="lineNum"> 1017 </span> : -<span class="lineNum"> 1018 </span> : /** End iterator corresponding to get_matching_terms_begin() */ -<span class="lineNum"> 1019 </span> : TermIterator get_matching_terms_end(const MSetIterator &/*it*/) const { -<span class="lineNum"> 1020 </span> : return TermIterator(NULL); -<span class="lineNum"> 1021 </span> : } -<span class="lineNum"> 1022 </span> : -<span class="lineNum"> 1023 </span> : /** Register a MatchDecider. -<span class="lineNum"> 1024 </span> : * -<span class="lineNum"> 1025 </span> : * This is used to associate a name with a matchdecider. -<span class="lineNum"> 1026 </span> : * -<span class="lineNum"> 1027 </span> : * @deprecated This method is deprecated. It was added long ago with -<span class="lineNum"> 1028 </span> : * the intention that it would allow the remote backend to support -<span class="lineNum"> 1029 </span> : * use of MatchDecider objects, but there's a better approach. -<span class="lineNum"> 1030 </span> : * -<span class="lineNum"> 1031 </span> : * @param name The name to register this matchdecider as. -<span class="lineNum"> 1032 </span> : * @param mdecider The matchdecider. If omitted, then remove -<span class="lineNum"> 1033 </span> : * any matchdecider registered with this name. -<span class="lineNum"> 1034 </span> : */ -<span class="lineNum"> 1035 </span> : XAPIAN_DEPRECATED( -<span class="lineNum"> 1036 </span> : void register_match_decider(const std::string &name, -<span class="lineNum"> 1037 </span> : const MatchDecider *mdecider = NULL)); -<span class="lineNum"> 1038 </span> : -<span class="lineNum"> 1039 </span> : /// Return a string describing this object. -<span class="lineNum"> 1040 </span> : std::string get_description() const; -<span class="lineNum"> 1041 </span> : }; -<span class="lineNum"> 1042 </span> : -<span class="lineNum"> 1043 </span> : } -<span class="lineNum"> 1044 </span> : -<span class="lineNum"> 1045 </span> : class RemoteServer; -<span class="lineNum"> 1046 </span> : class ScaleWeight; -<span class="lineNum"> 1047 </span> : -<span class="lineNum"> 1048 </span> : namespace Xapian { -<span class="lineNum"> 1049 </span> : -<span class="lineNum"> 1050 </span> : /// Abstract base class for weighting schemes -<span class="lineNum"> 1051 </span> : class XAPIAN_VISIBILITY_DEFAULT Weight { -<span class="lineNum"> 1052 </span> : friend class Enquire; // So Enquire can clone us -<span class="lineNum"> 1053 </span> : friend class ::RemoteServer; // So RemoteServer can clone us - FIXME -<span class="lineNum"> 1054 </span> : friend class ::ScaleWeight; -<span class="lineNum"> 1055 </span> : public: -<span class="lineNum"> 1056 </span> : class Internal; -<span class="lineNum"> 1057 </span> : protected: -<span class="lineNum"> 1058 </span> : Weight(const Weight &); -<span class="lineNum"> 1059 </span> : private: -<span class="lineNum"> 1060 </span> : void operator=(Weight &); -<span class="lineNum"> 1061 </span> : -<span class="lineNum"> 1062 </span> : /** Return a new weight object of this type. -<span class="lineNum"> 1063 </span> : * -<span class="lineNum"> 1064 </span> : * A subclass called FooWeight taking parameters param1 and param2 -<span class="lineNum"> 1065 </span> : * should implement this as: -<span class="lineNum"> 1066 </span> : * -<span class="lineNum"> 1067 </span> : * virtual FooWeight * clone() const { -<span class="lineNum"> 1068 </span> : * return new FooWeight(param1, param2); -<span class="lineNum"> 1069 </span> : * } -<span class="lineNum"> 1070 </span> : */ -<span class="lineNum"> 1071 </span> : virtual Weight * clone() const = 0; -<span class="lineNum"> 1072 </span> : -<span class="lineNum"> 1073 </span> : protected: -<span class="lineNum"> 1074 </span> : const Internal * internal; // Weight::Internal == Stats -<span class="lineNum"> 1075 </span> : Xapian::doclength querysize; -<span class="lineNum"> 1076 </span> : Xapian::termcount wqf; -<span class="lineNum"> 1077 </span> : std::string tname; -<span class="lineNum"> 1078 </span> : -<span class="lineNum"> 1079 </span> : public: -<span class="lineNum"> 1080 </span> : // FIXME:1.1: initialise internal to NULL here -<span class="lineNum"> 1081 </span> : Weight() { } -<span class="lineNum"> 1082 </span> : virtual ~Weight(); -<span class="lineNum"> 1083 </span> : -<span class="lineNum"> 1084 </span> : /** Create a new weight object of the same type as this and initialise -<span class="lineNum"> 1085 </span> : * it with the specified statistics. -<span class="lineNum"> 1086 </span> : * -<span class="lineNum"> 1087 </span> : * You shouldn't call this method yourself - it's called by -<span class="lineNum"> 1088 </span> : * Enquire. -<span class="lineNum"> 1089 </span> : * -<span class="lineNum"> 1090 </span> : * @param internal_ Object to ask for collection statistics. -<span class="lineNum"> 1091 </span> : * @param querysize_ Query size. -<span class="lineNum"> 1092 </span> : * @param wqf_ Within query frequency of term this object is -<span class="lineNum"> 1093 </span> : * associated with. -<span class="lineNum"> 1094 </span> : * @param tname_ Term which this object is associated with. -<span class="lineNum"> 1095 </span> : */ -<span class="lineNum"> 1096 </span> : Weight * create(const Internal * internal_, Xapian::doclength querysize_, -<span class="lineNum"> 1097 </span> : Xapian::termcount wqf_, const std::string & tname_) const; -<span class="lineNum"> 1098 </span> : -<span class="lineNum"> 1099 </span> : /** Name of the weighting scheme. -<span class="lineNum"> 1100 </span> : * -<span class="lineNum"> 1101 </span> : * If the subclass is called FooWeight, this should return "Foo". -<span class="lineNum"> 1102 </span> : */ -<span class="lineNum"> 1103 </span> : virtual std::string name() const = 0; -<span class="lineNum"> 1104 </span> : -<span class="lineNum"> 1105 </span> : /// Serialise object parameters into a string. -<span class="lineNum"> 1106 </span> : virtual std::string serialise() const = 0; -<span class="lineNum"> 1107 </span> : -<span class="lineNum"> 1108 </span> : /// Create object given string serialisation returned by serialise(). -<span class="lineNum"> 1109 </span> : virtual Weight * unserialise(const std::string &s) const = 0; -<span class="lineNum"> 1110 </span> : -<span class="lineNum"> 1111 </span> : /** Get a weight which is part of the sum over terms being performed. -<span class="lineNum"> 1112 </span> : * This returns a weight for a given term and document. These -<span class="lineNum"> 1113 </span> : * weights are summed to give a total weight for the document. -<span class="lineNum"> 1114 </span> : * -<span class="lineNum"> 1115 </span> : * @param wdf the within document frequency of the term. -<span class="lineNum"> 1116 </span> : * @param len the (unnormalised) document length. -<span class="lineNum"> 1117 </span> : */ -<span class="lineNum"> 1118 </span> : virtual Xapian::weight get_sumpart(Xapian::termcount wdf, -<span class="lineNum"> 1119 </span> : Xapian::doclength len) const = 0; -<span class="lineNum"> 1120 </span> : -<span class="lineNum"> 1121 </span> : /** Gets the maximum value that get_sumpart() may return. This -<span class="lineNum"> 1122 </span> : * is used in optimising searches, by having the postlist tree -<span class="lineNum"> 1123 </span> : * decay appropriately when parts of it can have limited, or no, -<span class="lineNum"> 1124 </span> : * further effect. -<span class="lineNum"> 1125 </span> : */ -<span class="lineNum"> 1126 </span> : virtual Xapian::weight get_maxpart() const = 0; -<span class="lineNum"> 1127 </span> : -<span class="lineNum"> 1128 </span> : /** Get an extra weight for a document to add to the sum calculated -<span class="lineNum"> 1129 </span> : * over the query terms. -<span class="lineNum"> 1130 </span> : * This returns a weight for a given document, and is used by some -<span class="lineNum"> 1131 </span> : * weighting schemes to account for influence such as document -<span class="lineNum"> 1132 </span> : * length. -<span class="lineNum"> 1133 </span> : * -<span class="lineNum"> 1134 </span> : * @param len the (unnormalised) document length. -<span class="lineNum"> 1135 </span> : */ -<span class="lineNum"> 1136 </span> : virtual Xapian::weight get_sumextra(Xapian::doclength len) const = 0; -<span class="lineNum"> 1137 </span> : -<span class="lineNum"> 1138 </span> : /** Gets the maximum value that get_sumextra() may return. This -<span class="lineNum"> 1139 </span> : * is used in optimising searches. -<span class="lineNum"> 1140 </span> : */ -<span class="lineNum"> 1141 </span> : virtual Xapian::weight get_maxextra() const = 0; -<span class="lineNum"> 1142 </span> : -<span class="lineNum"> 1143 </span> : /// return false if the weight object doesn't need doclength -<span class="lineNum"> 1144 </span> : virtual bool get_sumpart_needs_doclength() const; /* { return true; } */ -<span class="lineNum"> 1145 </span> : }; -<span class="lineNum"> 1146 </span> : -<span class="lineNum"> 1147 </span> : /// Boolean weighting scheme (everything gets 0) -<span class="lineNum"> 1148 </span> : class XAPIAN_VISIBILITY_DEFAULT BoolWeight : public Weight { -<span class="lineNum"> 1149 </span> : public: -<span class="lineNum"> 1150 </span> : BoolWeight * clone() const; -<span class="lineNum"> 1151 </span> : BoolWeight() { } -<span class="lineNum"> 1152 </span> : ~BoolWeight(); -<span class="lineNum"> 1153 </span> : std::string name() const; -<span class="lineNum"> 1154 </span> : std::string serialise() const; -<span class="lineNum"> 1155 </span> : BoolWeight * unserialise(const std::string & s) const; -<span class="lineNum"> 1156 </span> : Xapian::weight get_sumpart(Xapian::termcount wdf, Xapian::doclength len) const; -<span class="lineNum"> 1157 </span> : Xapian::weight get_maxpart() const; -<span class="lineNum"> 1158 </span> : -<span class="lineNum"> 1159 </span> : Xapian::weight get_sumextra(Xapian::doclength len) const; -<span class="lineNum"> 1160 </span> : Xapian::weight get_maxextra() const; -<span class="lineNum"> 1161 </span> : -<span class="lineNum"> 1162 </span> : bool get_sumpart_needs_doclength() const; -<span class="lineNum"> 1163 </span> : }; -<span class="lineNum"> 1164 </span> : -<span class="lineNum"> 1165 </span> : /** BM25 weighting scheme -<span class="lineNum"> 1166 </span> : * -<span class="lineNum"> 1167 </span> : * BM25 weighting options : The BM25 formula is \f[ -<span class="lineNum"> 1168 </span> : * \frac{k_{2}.n_{q}}{1+L_{d}}+\sum_{t}\frac{(k_{3}+1)q_{t}}{k_{3}+q_{t}}.\frac{(k_{1}+1)f_{t,d}}{k_{1}((1-b)+bL_{d})+f_{t,d}}.w_{t} -<span class="lineNum"> 1169 </span> : * \f] where -<span class="lineNum"> 1170 </span> : * - \f$w_{t}\f$ is the termweight of term t -<span class="lineNum"> 1171 </span> : * - \f$f_{t,d}\f$ is the within document frequency of term t in document d -<span class="lineNum"> 1172 </span> : * - \f$q_{t}\f$ is the within query frequency of term t -<span class="lineNum"> 1173 </span> : * - \f$L_{d}\f$ is the normalised length of document d -<span class="lineNum"> 1174 </span> : * - \f$n_{q}\f$ is the size of the query -<span class="lineNum"> 1175 </span> : * - \f$k_{1}\f$, \f$k_{2}\f$, \f$k_{3}\f$ and \f$b\f$ are user specified parameters -<span class="lineNum"> 1176 </span> : */ -<span class="lineNum"> 1177 </span> : class XAPIAN_VISIBILITY_DEFAULT BM25Weight : public Weight { -<span class="lineNum"> 1178 </span> : private: -<span class="lineNum"> 1179 </span> : mutable Xapian::weight termweight; -<span class="lineNum"> 1180 </span> : mutable Xapian::doclength lenpart; -<span class="lineNum"> 1181 </span> : -<span class="lineNum"> 1182 </span> : double k1, k2, k3, b; -<span class="lineNum"> 1183 </span> : Xapian::doclength min_normlen; -<span class="lineNum"> 1184 </span> : -<span class="lineNum"> 1185 </span> : mutable bool weight_calculated; -<span class="lineNum"> 1186 </span> : -<span class="lineNum"> 1187 </span> : void calc_termweight() const; -<span class="lineNum"> 1188 </span> : -<span class="lineNum"> 1189 </span> : public: -<span class="lineNum"> 1190 </span> : /** Construct a BM25 weight. -<span class="lineNum"> 1191 </span> : * -<span class="lineNum"> 1192 </span> : * @param k1 governs the importance of within document frequency. -<span class="lineNum"> 1193 </span> : * Must be >= 0. 0 means ignore wdf. Default is 1. -<span class="lineNum"> 1194 </span> : * @param k2 compensation factor for the high wdf values in -<span class="lineNum"> 1195 </span> : * large documents. Must be >= 0. 0 means no -<span class="lineNum"> 1196 </span> : * compensation. Default is 0. -<span class="lineNum"> 1197 </span> : * @param k3 governs the importance of within query frequency. -<span class="lineNum"> 1198 </span> : * Must be >= 0. 0 means ignore wqf. Default is 1. -<span class="lineNum"> 1199 </span> : * @param b Relative importance of within document frequency and -<span class="lineNum"> 1200 </span> : * document length. Must be >= 0 and <= 1. Default -<span class="lineNum"> 1201 </span> : * is 0.5. -<span class="lineNum"> 1202 </span> : * @param min_normlen specifies a cutoff on the minimum value that -<span class="lineNum"> 1203 </span> : * can be used for a normalised document length - -<span class="lineNum"> 1204 </span> : * smaller values will be forced up to this cutoff. -<span class="lineNum"> 1205 </span> : * This prevents very small documents getting a huge -<span class="lineNum"> 1206 </span> : * bonus weight. Default is 0.5. -<span class="lineNum"> 1207 </span> : */ -<span class="lineNum"> 1208 </span> : BM25Weight(double k1_, double k2_, double k3_, double b_, -<span class="lineNum"> 1209 </span> : double min_normlen_) -<span class="lineNum"> 1210 </span> : : k1(k1_), k2(k2_), k3(k3_), b(b_), min_normlen(min_normlen_), -<span class="lineNum"> 1211 </span> : weight_calculated(false) -<span class="lineNum"> 1212 </span> : { -<span class="lineNum"> 1213 </span> : if (k1 < 0) k1 = 0; -<span class="lineNum"> 1214 </span> : if (k2 < 0) k2 = 0; -<span class="lineNum"> 1215 </span> : if (k3 < 0) k3 = 0; -<span class="lineNum"> 1216 </span> : if (b < 0) b = 0; else if (b > 1) b = 1; -<span class="lineNum"> 1217 </span> : } -<span class="lineNum"> 1218 </span> : BM25Weight() : k1(1), k2(0), k3(1), b(0.5), min_normlen(0.5), -<span class="lineNum"> 1219 </span> : weight_calculated(false) { } -<span class="lineNum"> 1220 </span> : -<span class="lineNum"> 1221 </span> : BM25Weight * clone() const; -<span class="lineNum"> 1222 </span> : ~BM25Weight() { } -<span class="lineNum"> 1223 </span> : std::string name() const; -<span class="lineNum"> 1224 </span> : std::string serialise() const; -<span class="lineNum"> 1225 </span> : BM25Weight * unserialise(const std::string & s) const; -<span class="lineNum"> 1226 </span> : Xapian::weight get_sumpart(Xapian::termcount wdf, Xapian::doclength len) const; -<span class="lineNum"> 1227 </span> : Xapian::weight get_maxpart() const; -<span class="lineNum"> 1228 </span> : -<span class="lineNum"> 1229 </span> : Xapian::weight get_sumextra(Xapian::doclength len) const; -<span class="lineNum"> 1230 </span> : Xapian::weight get_maxextra() const; -<span class="lineNum"> 1231 </span> : -<span class="lineNum"> 1232 </span> : bool get_sumpart_needs_doclength() const; -<span class="lineNum"> 1233 </span> : }; -<span class="lineNum"> 1234 </span> : -<span class="lineNum"> 1235 </span> : /** Traditional probabilistic weighting scheme. -<span class="lineNum"> 1236 </span> : * -<span class="lineNum"> 1237 </span> : * This class implements the Traditional Probabilistic Weighting scheme, as -<span class="lineNum"> 1238 </span> : * described by the early papers on Probabilistic Retrieval. BM25 generally -<span class="lineNum"> 1239 </span> : * gives better results. -<span class="lineNum"> 1240 </span> : * -<span class="lineNum"> 1241 </span> : * The Traditional weighting scheme formula is \f[ -<span class="lineNum"> 1242 </span> : * \sum_{t}\frac{f_{t,d}}{k.L_{d}+f_{t,d}}.w_{t} -<span class="lineNum"> 1243 </span> : * \f] where -<span class="lineNum"> 1244 </span> : * - \f$w_{t}\f$ is the termweight of term t -<span class="lineNum"> 1245 </span> : * - \f$f_{t,d}\f$ is the within document frequency of term t in document d -<span class="lineNum"> 1246 </span> : * - \f$L_{d}\f$ is the normalised length of document d -<span class="lineNum"> 1247 </span> : * - \f$k\f$ is a user specifiable parameter -<span class="lineNum"> 1248 </span> : * -<span class="lineNum"> 1249 </span> : * TradWeight(k) is equivalent to BM25Weight(k, 0, 0, 1, 0), except that -<span class="lineNum"> 1250 </span> : * the latter returns weights (k+1) times larger. -<span class="lineNum"> 1251 </span> : */ -<span class="lineNum"> 1252 </span> : class XAPIAN_VISIBILITY_DEFAULT TradWeight : public Weight { -<span class="lineNum"> 1253 </span> : private: -<span class="lineNum"> 1254 </span> : mutable Xapian::weight termweight; -<span class="lineNum"> 1255 </span> : mutable Xapian::doclength lenpart; -<span class="lineNum"> 1256 </span> : -<span class="lineNum"> 1257 </span> : double param_k; -<span class="lineNum"> 1258 </span> : -<span class="lineNum"> 1259 </span> : mutable bool weight_calculated; -<span class="lineNum"> 1260 </span> : -<span class="lineNum"> 1261 </span> : void calc_termweight() const; -<span class="lineNum"> 1262 </span> : -<span class="lineNum"> 1263 </span> : public: -<span class="lineNum"> 1264 </span> : /** Construct a TradWeight -<span class="lineNum"> 1265 </span> : * -<span class="lineNum"> 1266 </span> : * @param k parameter governing the importance of within -<span class="lineNum"> 1267 </span> : * document frequency and document length - any non-negative -<span class="lineNum"> 1268 </span> : * number (0 meaning to ignore wdf and doc length when -<span class="lineNum"> 1269 </span> : * calculating weights). Default is 1. -<span class="lineNum"> 1270 </span> : */ -<span class="lineNum"> 1271 </span> : explicit TradWeight(double k) : param_k(k), weight_calculated(false) { -<span class="lineNum"> 1272 </span> : if (param_k < 0) param_k = 0; -<span class="lineNum"> 1273 </span> : } -<span class="lineNum"> 1274 </span> : -<span class="lineNum"> 1275 </span> : TradWeight() : param_k(1.0), weight_calculated(false) { } -<span class="lineNum"> 1276 </span> : -<span class="lineNum"> 1277 </span> : TradWeight * clone() const; -<span class="lineNum"> 1278 </span> : ~TradWeight() { } -<span class="lineNum"> 1279 </span> : std::string name() const; -<span class="lineNum"> 1280 </span> : std::string serialise() const; -<span class="lineNum"> 1281 </span> : TradWeight * unserialise(const std::string & s) const; -<span class="lineNum"> 1282 </span> : -<span class="lineNum"> 1283 </span> : Xapian::weight get_sumpart(Xapian::termcount wdf, Xapian::doclength len) const; -<span class="lineNum"> 1284 </span> : Xapian::weight get_maxpart() const; -<span class="lineNum"> 1285 </span> : -<span class="lineNum"> 1286 </span> : Xapian::weight get_sumextra(Xapian::doclength len) const; -<span class="lineNum"> 1287 </span> : Xapian::weight get_maxextra() const; -<span class="lineNum"> 1288 </span> : -<span class="lineNum"> 1289 </span> : bool get_sumpart_needs_doclength() const; -<span class="lineNum"> 1290 </span> : }; -<span class="lineNum"> 1291 </span> : -<span class="lineNum"> 1292 </span> : } -<span class="lineNum"> 1293 </span> : -<span class="lineNum"> 1294 </span> : #endif /* XAPIAN_INCLUDED_ENQUIRE_H */ -</pre> - </td> - </tr> - </table> - <br> - - <table width="100%" border=0 cellspacing=0 cellpadding=0> - <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> - <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr> - </table> - <br> - -</body> -</html> |