Branch data Line data Source code
1 : : /* selectpostlist.cc: Parent class for classes which only return selected docs
2 : : *
3 : : * Copyright 1999,2000,2001 BrightStation PLC
4 : : * Copyright 2002 Ananova Ltd
5 : : * Copyright 2003,2004,2007,2010 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, write to the Free Software
19 : : * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20 : : * USA
21 : : */
22 : :
23 : : #include <config.h>
24 : : #include "selectpostlist.h"
25 : :
26 : : #include "debuglog.h"
27 : : #include "omassert.h"
28 : :
29 : : PostList *
30 : 3764 : SelectPostList::next(Xapian::weight w_min)
31 : : {
32 : : LOGCALL(MATCH, PostList *, "SelectPostList::next", w_min);
33 [ + + + + ]: 3764 : do {
[ + + ]
34 : 3764 : PostList *p = source->next(w_min);
35 : : (void)p;
36 : : Assert(p == NULL); // AND should never prune
37 : 6520 : } while (!source->at_end() && !test_doc());
38 : 2334 : RETURN(NULL);
39 : : }
40 : :
41 : : PostList *
42 : 0 : SelectPostList::skip_to(Xapian::docid did, Xapian::weight w_min)
43 : : {
44 : : LOGCALL(MATCH, PostList *, "SelectPostList::skip_to", did | w_min);
45 [ # # ]: 0 : if (did > get_docid()) {
46 : 0 : PostList *p = source->skip_to(did, w_min);
47 : : (void)p;
48 : : Assert(p == NULL); // AND should never prune
49 [ # # # # ]: 0 : if (!source->at_end() && !test_doc())
[ # # ]
50 : 0 : RETURN(SelectPostList::next(w_min));
51 : : }
52 : 0 : RETURN(NULL);
53 : : }
54 : :
55 : : PostList *
56 : 16 : SelectPostList::check(Xapian::docid did, Xapian::weight w_min, bool &valid)
57 : : {
58 : : LOGCALL(MATCH, PostList *, "SelectPostList::check", did | w_min | valid);
59 : 16 : PostList *p = source->check(did, w_min, valid);
60 : : (void)p;
61 : : Assert(p == NULL); // AND should never prune
62 [ + - - + ]: 16 : if (valid && !source->at_end() && !test_doc())
[ # # ][ - + ]
63 : 0 : valid = false;
64 : 16 : RETURN(NULL);
65 : : }
|