xapian-core  2.0.0
net_postlist.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2007,2009 Lemur Consulting Ltd
5  * Copyright (C) 2007,2008,2009,2011,2019,2024 Olly Betts
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (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 #ifndef XAPIAN_INCLUDED_NET_POSTLIST_H
23 #define XAPIAN_INCLUDED_NET_POSTLIST_H
24 
25 #include <string>
26 
27 #include "backends/leafpostlist.h"
28 #include "omassert.h"
29 #include "remote-database.h"
30 
31 #include <string_view>
32 
35 class NetworkPostList : public LeafPostList {
36  friend class RemoteDatabase;
37 
39 
40  std::string postings;
41  bool started = false;
42  const char* pos = NULL;
43  const char* pos_end = NULL;
44 
47 
48  public:
51  std::string_view term_,
52  Xapian::doccount termfreq_,
53  std::string&& postings_)
54  : LeafPostList(term_), db(db_), postings(std::move(postings_)) {
55  termfreq = termfreq_;
56  // collfreq is only used during the match and remote shards are handled
57  // by running the match on the remote.
58  }
59 
61  Xapian::docid get_docid() const;
62 
64  Xapian::termcount get_wdf() const;
65 
69 
72  PostList * next(double);
73 
76  PostList * skip_to(Xapian::docid did, double weight);
77 
79  bool at_end() const;
80 
82 
84  std::string get_description() const;
85 };
86 
87 #endif /* XAPIAN_INCLUDED_NET_POSTLIST_H */
Abstract base class for leaf postlists.
Definition: leafpostlist.h:40
const Xapian::Weight * weight
Definition: leafpostlist.h:48
A postlist in a remote database.
Definition: net_postlist.h:35
PostList * skip_to(Xapian::docid did, double weight)
Skip forward to the next document with document ID >= the supplied document ID (the weight parameter ...
Definition: net_postlist.cc:75
std::string get_description() const
Get a description of the postlist.
NetworkPostList(Xapian::Internal::intrusive_ptr< const RemoteDatabase > db_, std::string_view term_, Xapian::doccount termfreq_, std::string &&postings_)
Constructor.
Definition: net_postlist.h:50
std::string postings
Definition: net_postlist.h:40
Xapian::docid get_docid() const
Get the current document ID.
Definition: net_postlist.cc:33
Xapian::docid lastdocid
Definition: net_postlist.h:45
bool at_end() const
Return true if and only if we've moved off the end of the list.
Definition: net_postlist.cc:85
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 ...
Definition: net_postlist.cc:45
Xapian::Internal::intrusive_ptr< const RemoteDatabase > db
Definition: net_postlist.h:38
const char * pos_end
Definition: net_postlist.h:43
Xapian::termcount get_wdf_upper_bound() const
Definition: net_postlist.cc:91
Xapian::termcount lastwdf
Definition: net_postlist.h:46
Xapian::termcount get_wdf() const
Get the Within Document Frequency of the term in the current document.
Definition: net_postlist.cc:39
const char * pos
Definition: net_postlist.h:42
RemoteDatabase is the baseclass for remote database implementations.
Abstract base class for postlists.
Definition: postlist.h:40
PostList * next()
Advance the current position to the next document in the postlist.
Definition: postlist.h:168
Xapian::doccount termfreq
Estimate of the number of documents this PostList will return.
Definition: postlist.h:52
Abstract base class for iterating term positions in a document.
Definition: positionlist.h:32
Abstract base class for leaf postlists.
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
Various assertion macros.
RemoteDatabase is the baseclass for remote database implementations.