xapian-core  2.0.0
glass_alldocspostlist.cc
Go to the documentation of this file.
1 
4 /* Copyright (C) 2006,2007,2008,2009,2024 Olly Betts
5  * Copyright (C) 2008 Lemur Consulting Ltd
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see
19  * <https://www.gnu.org/licenses/>.
20  */
21 
22 #include <config.h>
23 #include "glass_alldocspostlist.h"
24 
25 #include <string>
26 
27 #include "glass_database.h"
28 #include "debuglog.h"
29 
30 #include "str.h"
31 
32 using namespace std;
34 
37  : GlassPostList(db_, {}, true)
38 {
39  LOGCALL_CTOR(DB, "GlassAllDocsPostList", db_.get() | doccount);
40  /* For an all documents postlist the term frequency is the number of
41  * documents in the database.
42  */
43  termfreq = doccount;
44 }
45 
48 {
49  LOGCALL(DB, Xapian::termcount, "GlassAllDocsPostList::get_wdf", NO_ARGS);
51  RETURN(1);
52 }
53 
56 {
57  LOGCALL(DB, PositionList *, "GlassAllDocsPostList::read_position_list", NO_ARGS);
58  throw Xapian::InvalidOperationError("GlassAllDocsPostList::read_position_list() not meaningful");
59 }
60 
63 {
64  LOGCALL(DB, PositionList *, "GlassAllDocsPostList::open_position_list", NO_ARGS);
65  throw Xapian::InvalidOperationError("GlassAllDocsPostList::open_position_list() not meaningful");
66 }
67 
68 string
70 {
71  string desc = "GlassAllDocsPostList(doccount=";
72  desc += str(termfreq);
73  desc += ')';
74  return desc;
75 }
PositionList * read_position_list()
Read the position list for the term in the current document and return a pointer to it (owned by the ...
Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
GlassAllDocsPostList(const GlassAllDocsPostList &)
Don't allow copying.
std::string get_description() const
Return a string description of this object.
PositionList * open_position_list() const
Read the position list for the term in the current document and return a pointer to it (not owned by ...
A postlist in a glass database.
bool at_end() const
Return true if and only if we're off the end of the list.
Xapian::doccount termfreq
Estimate of the number of documents this PostList will return.
Definition: postlist.h:52
A smart pointer that uses intrusive reference counting.
Definition: intrusive_ptr.h:83
InvalidOperationError indicates the API was used in an invalid way.
Definition: error.h:271
Abstract base class for iterating term positions in a document.
Definition: positionlist.h:32
Debug logging macros.
#define RETURN(...)
Definition: debuglog.h:484
#define LOGCALL(CATEGORY, TYPE, FUNC, PARAMS)
Definition: debuglog.h:478
#define LOGCALL_CTOR(CATEGORY, CLASS, PARAMS)
Definition: debuglog.h:480
A PostList which iterates over all documents in a GlassDatabase.
C++ class definition for glass database.
string str(int value)
Convert int to std::string.
Definition: str.cc:91
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
#define AssertParanoid(COND)
Definition: omassert.h:129
Convert types to std::string.