xapian-core  2.0.0
postingiteratorinternal.h
Go to the documentation of this file.
1 
4 /* Copyright 2017 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_POSTINGITERATORINTERNAL_H
22 #define XAPIAN_INCLUDED_POSTINGITERATORINTERNAL_H
23 
24 #include "xapian/postingiterator.h"
25 
26 #include "backends/postlist.h"
27 
28 namespace Xapian {
29 
31  friend class PostingIterator;
32 
34 
36 
37  unsigned _refs = 0;
38 
39  public:
41  : pl(pl_), db(db_) {}
42 
44  delete pl;
45  }
46 
48  return pl->get_docid();
49  }
50 
52  return pl->get_wdf();
53  }
54 
56  return db.get_doclength(pl->get_docid());
57  }
58 
60  return db.get_unique_terms(pl->get_docid());
61  }
62 
64  return db.get_wdfdocmax(pl->get_docid());
65  }
66 
68  return pl->open_position_list();
69  }
70 
71  bool next() {
72  (void)pl->next();
73  return !pl->at_end();
74  }
75 
76  bool skip_to(Xapian::docid did) {
77  (void)pl->skip_to(did);
78  return !pl->at_end();
79  }
80 
81  std::string get_description() const {
82  return pl->get_description();
83  }
84 };
85 
86 }
87 
88 #endif // XAPIAN_INCLUDED_POSTINGITERATORINTERNAL_H
An indexed database of documents.
Definition: database.h:75
Xapian::termcount get_wdfdocmax(Xapian::docid did) const
Get the maximum wdf value in a specified document.
Definition: database.cc:359
Xapian::termcount get_doclength(Xapian::docid did) const
Get the length of a specified document.
Definition: database.cc:341
Xapian::termcount get_unique_terms(Xapian::docid did) const
Get the number of unique terms in a specified document.
Definition: database.cc:350
Abstract base class for postlists.
Definition: postlist.h:40
virtual PostList * skip_to(Xapian::docid did, double w_min)=0
Skip forward to the specified docid.
virtual PostList * next(double w_min)=0
Advance the current position to the next document in the postlist.
virtual Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
Definition: postlist.cc:34
virtual Xapian::docid get_docid() const =0
Return the current docid.
virtual bool at_end() const =0
Return true if the current position is past the last entry in this list.
virtual 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: postlist.cc:46
virtual std::string get_description() const =0
Return a string description of this object.
Abstract base class for iterating term positions in a document.
Definition: positionlist.h:32
Xapian::termcount get_doclength() const
Xapian::termcount get_unique_terms() const
Xapian::termcount get_wdfdocmax() const
Internal(PostList *pl_, const Xapian::Database &db_)
Class for iterating over a list of terms.
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 docid
A unique identifier for a document.
Definition: types.h:51
Class for iterating over a list of document ids.
Abstract base class for postlists.