xapian-core  2.0.0
honey_termlist.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2007,2008,2009,2010,2011,2024 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (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_HONEY_TERMLIST_H
22 #define XAPIAN_INCLUDED_HONEY_TERMLIST_H
23 
24 #include <algorithm>
25 #include <string>
26 
27 #include "xapian/intrusive_ptr.h"
29 #include <xapian/types.h>
30 
31 namespace Xapian {
32  namespace Internal {
33  class ExpandStats;
34  }
35 }
36 
37 #include "honey_database.h"
38 #include "api/termlist.h"
39 #include "honey_table.h"
40 
42 class HoneyTermList : public TermList {
44  void operator=(const HoneyTermList&);
45 
48 
51 
54 
57 
60 
62  std::string data;
63 
68  const char* pos;
69 
71  const char* end;
72 
75 
82 
83  public:
85  HoneyTermList(const HoneyDatabase* db_, Xapian::docid did_);
86 
92  return doclen;
93  }
94 
100  return termlist_size;
101  }
102 
108  // We approximate get_unique_terms() by the length of the termlist
109  // (which counts boolean terms too) but clamp the result to be no
110  // larger than the document length.
111  return std::min(termlist_size, doclen);
112  }
113 
119 
122 
124  Xapian::termcount get_wdf() const;
125 
134 
143  TermList* next();
144 
145  TermList* skip_to(std::string_view term);
146 
149 
152 };
153 
154 #endif // XAPIAN_INCLUDED_HONEY_TERMLIST_H
Database using honey backend.
A TermList in a honey database.
TermList * skip_to(std::string_view term)
Skip forward to the specified term.
PositionList * positionlist_begin() const
Return a PositionIterator for the current position.
const char * pos
Current position with the encoded tag value held in data.
Xapian::termcount get_approx_size() const
Return approximate size of this termlist.
const char * end
Pointer to the end of the encoded tag value.
Xapian::doccount current_termfreq
The term frequency for the term at the current position.
Xapian::termcount positionlist_count() const
Return the length of the position list for the current position.
Xapian::termcount get_wdf() const
Return the wdf for the term at the current position.
HoneyTermList(const HoneyTermList &)
Don't allow copying.
Xapian::termcount get_unique_terms() const
Return the number of unique terms.
Xapian::termcount doclen
The length of document did.
std::string data
The tag value from the termlist table which holds the encoded termlist.
Xapian::termcount get_doclength() const
Return the length of this document.
Xapian::termcount termlist_size
The number of entries in this termlist.
Xapian::termcount current_wdf
The wdf for the term at the current position.
Xapian::Internal::intrusive_ptr< const HoneyDatabase > db
The database we're reading data from.
Xapian::docid did
The document id that this TermList is for.
TermList * next()
Advance the current position to the next term in the termlist.
void accumulate_stats(Xapian::Internal::ExpandStats &stats) const
Collate weighting information for the current term.
Xapian::doccount get_termfreq() const
Return the term frequency for the term at the current position.
void operator=(const HoneyTermList &)
Don't allow assignment.
Xapian::termcount size() const
Return the number of entries in this termlist.
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
Database using honey backend.
HoneyTable class.
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
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:51
Class for iterating over term positions.
Abstract base class for termlists.
typedefs for Xapian