2 * @brief Return docs containing terms within a specified window.
4 * Copyright (C) 2006,2015,2017 Olly Betts
5 * Copyright (C) 2009 Lemur Consulting Ltd
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
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.
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 USA
22 #ifndef XAPIAN_INCLUDED_NEARPOSTLIST_H
23 #define XAPIAN_INCLUDED_NEARPOSTLIST_H
25 #include "selectpostlist.h"
31 /** Postlist which matches terms occurring within a specified window.
33 * NearPostList only returns a posting for documents contains all the terms
34 * (this part is implemented using an AndPostList) and additionally the terms
35 * occur somewhere in the document within a specified number of term
38 * The weight of a posting is the sum of the weights of the
39 * sub-postings (just like an AndPostList).
41 class NearPostList
: public SelectPostList
{
42 Xapian::termpos window
;
44 std::vector
<PostList
*> terms
;
46 PositionList
** poslists
;
48 /// Test if the current document contains the terms within the window.
52 NearPostList(PostList
*source_
,
53 EstimateOp
* estimate_op_
,
54 Xapian::termpos window_
,
55 const std::vector
<PostList
*>::const_iterator
&terms_begin
,
56 const std::vector
<PostList
*>::const_iterator
&terms_end
,
57 PostListTree
* pltree_
);
61 Xapian::termcount
get_wdf() const;
63 std::string
get_description() const;