48 Internal::ExpandTerm::get_description()
const 50 string desc(
"ExpandTerm(");
76 const set<Xapian::docid> & docids = rset.
internal->get_items();
78 vector<TermList*> termlists;
79 termlists.reserve(docids.size());
82 const size_t multiplier = db.
internal.size();
83 set<Xapian::docid>::const_iterator i;
84 for (i = docids.begin(); i != docids.end(); ++i) {
90 termlists.push_back(0);
91 termlists.back() = db.
internal[dbnumber]->open_term_list(realdid);
92 termlists.back()->shard_index = dbnumber;
95 Assert(!termlists.empty());
96 if (termlists.size() == 1)
return termlists[0];
100 make_heap(termlists.begin(), termlists.end(),
118 pop_heap(termlists.begin(), termlists.end(),
120 termlists.pop_back();
125 if (termlists.size() == 1)
return pl;
127 pop_heap(termlists.begin(), termlists.end(),
129 termlists.back() = pl;
130 push_heap(termlists.begin(), termlists.end(),
147 LOGCALL_VOID(EXPAND,
"ESet::Internal::expand", max_esize | db | rset | edecider | eweight);
159 bool is_heap =
false;
164 LOGLINE(EXPAND,
"Replacing the root of the termlist tree");
165 tree.reset(new_root);
168 if (tree->at_end())
break;
170 string term = tree->get_termname();
173 if (edecider && !(*edecider)(term))
continue;
185 if (wt <= min_wt)
continue;
191 if (items.size() > max_esize) {
192 if (
rare(!is_heap)) {
194 make_heap(items.begin(), items.end());
196 push_heap(items.begin(), items.end());
198 pop_heap(items.begin(), items.end());
200 min_wt = items.front().wt;
206 sort_heap(items.begin(), items.end());
208 sort(items.begin(), items.end());
213 ESet::Internal::get_description()
const 215 string desc(
"ESet::Internal(ebound=");
218 vector<Xapian::Internal::ExpandTerm>::const_iterator i;
219 for (i = items.begin(); i != items.end(); ++i) {
221 desc += i->get_description();
230 ESet::ESet(
const ESet & o) : internal(o.internal) { }
249 if (!
internal.
get())
return 0;
250 return internal->items.size();
256 if (!
internal.
get())
return 0;
257 return internal->ebound;
263 string desc =
"ESet(";
265 desc +=
internal->get_description();
274 return (eset.internal->items.end() - off_from_end)->term;
280 return (eset.internal->items.end() - off_from_end)->wt;
286 string desc =
"ESetIterator(";
287 if (eset.internal.get())
288 desc +=
str(eset.internal->items.size() - off_from_end);
The Xapian namespace contains public interfaces for the Xapian library.
void collect_stats(TermList *merger, const std::string &term)
Get the term statistics.
virtual Internal * next()=0
Advance the current position to the next term in the termlist.
This class is used to access a database, or a group of databases.
void operator()(CLASS *p) const
virtual double get_weight() const =0
Calculate the weight.
#define AssertRel(A, REL, B)
bool operator()(const TermList *a, const TermList *b) const
Merge two TermList objects using an OR operation.
Class combining a term and its expand weight.
#define LOGCALL_VOID(CATEGORY, FUNC, PARAMS)
Abstract base class for termlists.
Convert types to std::string.
Virtual base class for expand decider functor.
std::vector< Xapian::Internal::intrusive_ptr< Internal > > internal
double get_weight() const
Get the weight for the current position.
ESet()
Default constructor.
Xapian::Internal::intrusive_ptr< Internal > internal
virtual Xapian::termcount get_approx_size() const =0
Return approximate size of this termlist.
Class for calculating ESet term weights.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Xapian::doccount size() const
Return number of items in this ESet object.
void description_append(std::string &desc, const std::string &s)
Collate statistics and calculate the term weights for the ESet.
std::string get_description() const
Return a string describing this object.
std::string operator*() const
Get the term at the current position.
string str(int value)
Convert int to std::string.
Xapian::termcount get_ebound() const
Return a bound on the full size of this ESet object.
Allow rejection of terms during ESet generation.
Xapian::Internal::intrusive_ptr< Internal > internal
Append a string to an object description, escaping invalid UTF-8.
Xapian::ESet::Internal class.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
static TermList * build_termlist_tree(const Xapian::Database &db, const RSet &rset)
Build a tree of binary TermList objects like QueryOptimiser does for OrPostList objects.
Abstract base class for termlists.
Class representing a list of search results.
std::string get_description() const
Return a string describing this object.
Various assertion macros.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
bool empty() const
Test if this R-Set is empty.
ESet & operator=(const ESet &o)
Copying is allowed.
Wrapper around standard unique_ptr template.