xapian-core  2.0.0
ortermlist.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2007,2010,2024 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see
18  * <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef XAPIAN_INCLUDED_ORTERMLIST_H
22 #define XAPIAN_INCLUDED_ORTERMLIST_H
23 
24 #include "api/termlist.h"
25 
26 namespace Xapian {
27 namespace Internal {
28 class ExpandStats;
29 }
30 }
31 
32 class OrTermList : public TermList {
33  protected:
36 
41  int cmp = 0;
42 
44  void check_started() const;
45 
46  public:
47  OrTermList(TermList * left_, TermList * right_)
48  : left(left_), right(right_) { }
49 
50  ~OrTermList();
51 
53 
55 
56  Xapian::termcount get_wdf() const;
57 
59 
60  TermList *next();
61 
62  TermList* skip_to(std::string_view term);
63 
65 
67 };
68 
76  public:
78  : OrTermList(left_, right_)
79  { }
80 
82 };
83 
84 #endif // XAPIAN_INCLUDED_ORTERMLIST_H
A termlist which ORs two termlists together, adding term frequencies.
Definition: ortermlist.h:75
Xapian::doccount get_termfreq() const
Return the term frequency for the term at the current position.
Definition: ortermlist.cc:205
FreqAdderOrTermList(TermList *left_, TermList *right_)
Definition: ortermlist.h:77
Xapian::termcount get_approx_size() const
Return approximate size of this termlist.
Definition: ortermlist.cc:46
TermList * next()
Advance the current position to the next term in the termlist.
Definition: ortermlist.cc:88
TermList * skip_to(std::string_view term)
Skip forward to the specified term.
Definition: ortermlist.cc:151
void check_started() const
Check that next() has already been called.
Definition: ortermlist.cc:33
PositionList * positionlist_begin() const
Return PositionList for the current position.
Definition: ortermlist.cc:197
TermList * right
Definition: ortermlist.h:35
OrTermList(TermList *left_, TermList *right_)
Definition: ortermlist.h:47
Xapian::doccount get_termfreq() const
Return the term frequency for the term at the current position.
Definition: ortermlist.cc:77
void accumulate_stats(Xapian::Internal::ExpandStats &stats) const
Collate weighting information for the current term.
Definition: ortermlist.cc:56
Xapian::termcount get_wdf() const
Return the wdf for the term at the current position.
Definition: ortermlist.cc:67
TermList * left
The two TermList objects we're merging.
Definition: ortermlist.h:35
int cmp
The result of left->get_termname().compare(right->get_termname()).
Definition: ortermlist.h:41
Xapian::termcount positionlist_count() const
Return the length of the position list for the current position.
Definition: ortermlist.cc:190
Collates statistics while calculating term weight in an ESet.
Definition: expandweight.h:37
Abstract base class for iterating term positions in a document.
Definition: positionlist.h:32
Abstract base class for termlists.
Definition: termlist.h:42
string term
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:82
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:64
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:37
Abstract base class for termlists.