3 * Copyright 1999,2000,2001 BrightStation PLC
4 * Copyright 2002,2003,2006,2007,2008,2009,2010,2017 Olly Betts
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.
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.
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
24 #include "net_termlist.h"
28 #include <xapian/error.h>
30 using Xapian::Internal::intrusive_ptr
;
32 NetworkTermList::NetworkTermList(Xapian::termcount document_length_
,
33 Xapian::doccount database_size_
,
34 intrusive_ptr
<const RemoteDatabase
> this_db_
,
37 current_position(items
.begin()),
39 document_length(document_length_
),
40 database_size(database_size_
),
47 NetworkTermList::get_approx_size() const
53 NetworkTermList::accumulate_stats(Xapian::Internal::ExpandStats
& stats
) const
58 stats
.accumulate(current_position
->wdf
,
60 current_position
->termfreq
,
65 NetworkTermList::get_termname() const
69 return current_position
->tname
;
73 NetworkTermList::get_wdf() const
77 return current_position
->wdf
;
81 NetworkTermList::get_termfreq() const
85 return current_position
->termfreq
;
89 NetworkTermList::next()
101 NetworkTermList::skip_to(const string
& term
)
103 while (current_position
!= items
.end() && current_position
->tname
< term
) {
111 NetworkTermList::at_end() const
114 return (current_position
== items
.end());
118 NetworkTermList::positionlist_count() const
120 return this_db
->positionlist_count(did
, get_termname());
123 Xapian::PositionIterator
124 NetworkTermList::positionlist_begin() const
126 return Xapian::PositionIterator(this_db
->open_position_list(did
, get_termname()));