2 * @brief Return docs containing terms within a specified window.
4 * Copyright (C) 2006,2015 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"
28 /** Postlist which matches terms occurring within a specified window.
30 * NearPostList only returns a posting for documents contains all the terms
31 * (this part is implemented using an AndPostList) and additionally the terms
32 * occur somewhere in the document within a specified number of term
35 * The weight of a posting is the sum of the weights of the
36 * sub-postings (just like an AndPostList).
38 class NearPostList
: public SelectPostList
{
39 Xapian::termpos window
;
41 std::vector
<PostList
*> terms
;
43 PositionList
** poslists
;
45 /// Test if the current document contains the terms within the window.
49 NearPostList(PostList
*source_
,
50 Xapian::termpos window_
,
51 const std::vector
<PostList
*>::const_iterator
&terms_begin
,
52 const std::vector
<PostList
*>::const_iterator
&terms_end
);
56 Xapian::termcount
get_wdf() const;
58 Xapian::doccount
get_termfreq_est() const;
60 TermFreqs
get_termfreq_est_using_stats(
61 const Xapian::Weight::Internal
& stats
) const;
63 std::string
get_description() const;