xapian-core  1.4.26
orpositionlist.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2007,2010,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, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef XAPIAN_INCLUDED_ORPOSITIONLIST_H
22 #define XAPIAN_INCLUDED_ORPOSITIONLIST_H
23 
24 #include "backends/positionlist.h"
25 #include "api/postlist.h"
26 
27 #include "xapian/error.h"
28 #include <algorithm>
29 #include <vector>
30 
31 class OrPositionList : public PositionList {
33  std::vector<PositionList*> pls;
34 
39  std::vector<Xapian::termpos> current;
40 
43 
44  public:
46 
48  pls.clear();
49  current.clear();
50  pl->gather_position_lists(this);
51  if (pls.size() == 1)
52  return pls[0];
53  return this;
54  }
55 
56  void add_poslist(PositionList* poslist) {
57  pls.push_back(poslist);
58  }
59 
61 
63 
64  bool next();
65 
67 };
68 
69 #endif // XAPIAN_INCLUDED_ORPOSITIONLIST_H
Abstract base class for postlists.
Definition: postlist.h:37
bool next()
Advance to the next entry in the positionlist.
virtual void gather_position_lists(OrPositionList *orposlist)
Gather PositionList* objects for a subtree.
bool skip_to(Xapian::termpos termpos)
Skip forward to the specified position.
Abstract base class for iterating term positions in a document.
std::vector< Xapian::termpos > current
Current positions of the subobjects.
Xapian::termpos current_pos
Current position of this object.
Abstract base class for postlists.
Xapian::termpos get_position() const
Return the current position.
Hierarchy of classes which Xapian can throw as exceptions.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:72
Xapian::termcount get_approx_size() const
Return approximate size of this positionlist.
PositionList * gather(PostList *pl)
void add_poslist(PositionList *poslist)
unsigned XAPIAN_TERMPOS_BASE_TYPE termpos
A term position within a document or query.
Definition: types.h:83
std::vector< PositionList * > pls
The PositionList sub-objects.
Abstract base class for iterating term positions in a document.
Definition: positionlist.h:31