xapian-core  2.0.0
termlist.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2007,2010,2013,2020,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_TERMLIST_H
22 #define XAPIAN_INCLUDED_TERMLIST_H
23 
24 #include "api/smallvector.h"
25 
26 #include "backends/positionlist.h"
27 
28 #include <string>
29 #include <string_view>
30 
31 #include "xapian/intrusive_ptr.h"
32 #include <xapian/types.h>
33 #include <xapian/termiterator.h>
34 
35 namespace Xapian {
36  namespace Internal {
37  class ExpandStats;
38  }
39 }
40 
44  void operator=(const Internal &) = delete;
45 
47  Internal(const Internal &) = delete;
48 
49  protected:
51  Internal() { }
52 
54  std::string current_term;
55 
56  public:
60  virtual ~Internal();
61 
63  virtual Xapian::termcount get_approx_size() const = 0;
64 
66  virtual void accumulate_stats(Xapian::Internal::ExpandStats & stats) const;
67 
69  const std::string& get_termname() const {
70  return current_term;
71  }
72 
74  virtual Xapian::termcount get_wdf() const = 0;
75 
77  virtual Xapian::doccount get_termfreq() const = 0;
78 
91  virtual Internal * next() = 0;
92 
104  virtual Internal* skip_to(std::string_view term) = 0;
105 
108 
117  virtual const Xapian::VecCOW<Xapian::termpos> * get_vec_termpos() const;
118 
120  virtual PositionList* positionlist_begin() const = 0;
121 
126  size_t shard_index = 0;
127 };
128 
129 // In the external API headers, this class is Xapian::TermIterator::Internal,
130 // but in the library code it's still known as "TermList" in most places.
132 
133 #endif // XAPIAN_INCLUDED_TERMLIST_H
Collates statistics while calculating term weight in an ESet.
Definition: expandweight.h:37
Base class for objects managed by intrusive_ptr.
Definition: intrusive_ptr.h:50
Abstract base class for iterating term positions in a document.
Definition: positionlist.h:32
Abstract base class for termlists.
Definition: termlist.h:42
virtual const Xapian::VecCOW< Xapian::termpos > * get_vec_termpos() const
Get pointer to VecCOW<termpos> if that's the internal representation.
Definition: termlist.cc:42
virtual Internal * skip_to(std::string_view term)=0
Skip forward to the specified term.
virtual PositionList * positionlist_begin() const =0
Return PositionList for the current position.
Internal()
Only constructable as a base class for derived classes.
Definition: termlist.h:51
void operator=(const Internal &)=delete
Don't allow assignment.
virtual void accumulate_stats(Xapian::Internal::ExpandStats &stats) const
Collate weighting information for the current term.
Definition: termlist.cc:34
std::string current_term
The current term.
Definition: termlist.h:54
size_t shard_index
Which shard of a multidatabase this is from.
Definition: termlist.h:126
virtual Xapian::doccount get_termfreq() const =0
Return the term frequency for the term at the current position.
virtual ~Internal()
We have virtual methods and want to be able to delete derived classes using a pointer to the base cla...
Definition: termlist.cc:31
Internal(const Internal &)=delete
Don't allow copying.
virtual Internal * next()=0
Advance the current position to the next term in the termlist.
const std::string & get_termname() const
Return the termname at the current position.
Definition: termlist.h:69
virtual Xapian::termcount positionlist_count() const =0
Return the length of the position list for the current position.
virtual Xapian::termcount get_approx_size() const =0
Return approximate size of this termlist.
virtual Xapian::termcount get_wdf() const =0
Return the wdf for the term at the current position.
Suitable for "simple" type T.
Definition: smallvector.h:62
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 iterating term positions in a document.
Custom vector implementations using small vector optimisation.
Class for iterating over a list of terms.
Xapian::TermIterator::Internal TermList
Definition: termlist.h:131
typedefs for Xapian