xapian-core  2.0.0
documenttermlist.h
Go to the documentation of this file.
1 
4 /* Copyright 2017,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_DOCUMENTTERMLIST_H
22 #define XAPIAN_INCLUDED_DOCUMENTTERMLIST_H
23 
24 #include "termlist.h"
25 
27 
28 #include "omassert.h"
29 
30 #include <functional>
31 
33 class DocumentTermList final : public TermList {
35  void operator=(const DocumentTermList&) = delete;
36 
39 
42 
47  std::map<std::string, TermInfo, std::less<>>::const_iterator it;
48 
49  public:
50  explicit
52  : doc(doc_), it(doc->terms->end()) {}
53 
55 
56  Xapian::termcount get_wdf() const;
57 
59 
61 
63 
65 
66  TermList * next();
67 
68  TermList* skip_to(std::string_view term);
69 };
70 
71 #endif // XAPIAN_INCLUDED_DOCUMENTTERMLIST_H
Iteration over terms in a document.
DocumentTermList(const Xapian::Document::Internal *doc_)
void operator=(const DocumentTermList &)=delete
Don't allow assignment.
const Xapian::VecCOW< Xapian::termpos > * get_vec_termpos() const
Get pointer to VecCOW<termpos> if that's the internal representation.
Xapian::doccount get_termfreq() const
Return the term frequency for the term at the current position.
TermList * skip_to(std::string_view term)
Skip forward to the specified term.
Xapian::termcount positionlist_count() const
Return the length of the position list for the current position.
DocumentTermList(const DocumentTermList &)=delete
Don't allow copying.
std::map< std::string, TermInfo, std::less<> >::const_iterator it
Iterator over the map inside doc.
PositionList * positionlist_begin() const
Return PositionList for the current position.
Xapian::Internal::intrusive_ptr< const Xapian::Document::Internal > doc
Document internals we're iterating over.
TermList * next()
Advance the current position to the next term in the termlist.
Xapian::termcount get_approx_size() const
Return approximate size of this termlist.
Xapian::termcount get_wdf() const
Return the wdf for the term at the current position.
Abstract base class for a document.
Abstract base class for iterating term positions in a document.
Definition: positionlist.h:32
Abstract base class for termlists.
Definition: termlist.h:42
Suitable for "simple" type T.
Definition: smallvector.h:62
string term
Abstract base class for a document.
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
Various assertion macros.
Abstract base class for termlists.