00001 /* selectpostlist.cc: Parent class for classes which only return selected docs 00002 * 00003 * Copyright 1999,2000,2001 BrightStation PLC 00004 * Copyright 2002 Ananova Ltd 00005 * Copyright 2003,2004,2007 Olly Betts 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License as 00009 * published by the Free Software Foundation; either version 2 of the 00010 * License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00020 * USA 00021 */ 00022 00023 #include <config.h> 00024 00025 #include "selectpostlist.h" 00026 #include "omassert.h" 00027 #include "omdebug.h" 00028 00029 PostList * 00030 SelectPostList::next(Xapian::weight w_min) 00031 { 00032 DEBUGCALL(MATCH, PostList *, "SelectPostList::next", w_min); 00033 do { 00034 PostList *p = source->next(w_min); 00035 (void)p; 00036 Assert(p == NULL); // AND should never prune 00037 } while (!source->at_end() && !test_doc()); 00038 RETURN(NULL); 00039 } 00040 00041 PostList * 00042 SelectPostList::skip_to(Xapian::docid did, Xapian::weight w_min) 00043 { 00044 DEBUGCALL(MATCH, PostList *, "SelectPostList::skip_to", did << ", " << w_min); 00045 if (did > get_docid()) { 00046 PostList *p = source->skip_to(did, w_min); 00047 (void)p; 00048 Assert(p == NULL); // AND should never prune 00049 if (!source->at_end() && !test_doc()) 00050 RETURN(SelectPostList::next(w_min)); 00051 } 00052 RETURN(NULL); 00053 }