root / tags / 1.0.8 / xapian-core / backends / flint / flint_modifiedpostlist.h

Revision 9256, 2.3 kB (checked in by olly, 16 months ago)

common/msvc_posix_wrapper.cc,common/msvc_posix_wrapper.h: Add
msvc_posix_rename() which can rename a file on top of another file.
common/stringutils.h: Add common_prefix_length() function.
backends/flint/: Clean up FlintWritableDatabase? - it now just
inherits from FlintDatabase? which allows several virtual methods
which just forwarded to FlintDatabase? to be dropped. Also, we
now no longer need to pass FlintTable objects to other classes
- they can just find the tables they want via the database pointer.
The never-used "store_termfreqs" flag has been dropped from the
termlist table entries - existing 1.0.x flint databases will be
automatically upgraded to the new version. Opening a database
now calls stat() less, so should be slightly more efficient.
And TermIterator::positionlist_count() now works for the flint
backend.
tests/Makefile.am,tests/api_db.cc,tests/testdata/flint-1.0.2/: New
test flintbackwardcompat2 which tests that we can open a flint
database from 1.0.2.
tests/api_wrdb.cc: New test adddoc4 which checks that termlists
handle an initial term of any valid length correctly.
tests/testdata/flint-1.0.1/postlist.DB: Mark as a binary file in
SVN.

Line 
1/** @file flint_modifiedpostlist.h
2 * @brief A FlintPostList plus pending modifications
3 */
4/* Copyright (C) 2006,2007 Olly Betts
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
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.
15 *
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 USA
19 */
20
21#ifndef XAPIAN_INCLUDED_FLINT_MODIFIEDPOSTLIST_H
22#define XAPIAN_INCLUDED_FLINT_MODIFIEDPOSTLIST_H
23
24#include <map>
25#include <string>
26
27using namespace std;
28
29#include "flint_postlist.h"
30
31class FlintModifiedPostList : public FlintPostList {
32    /// Modifications to apply to the FlintPostList.
33    //@{
34    map<Xapian::docid, pair<char, Xapian::termcount> > mods;
35    map<Xapian::docid, pair<char, Xapian::termcount> >::const_iterator it;
36    //@}
37
38    /// Pointer to PositionList returned from read_position_list to be deleted.
39    PositionList * poslist;
40
41    /// Skip over deleted documents after a next() or skip_to().
42    void skip_deletes(Xapian::weight w_min);
43
44  public:
45    /// Constructor.
46    FlintModifiedPostList(Xapian::Internal::RefCntPtr<const FlintDatabase> this_db_,
47                          const string & tname_,
48                          const map<Xapian::docid, pair<char, Xapian::termcount> > & mods_)
49        : FlintPostList(this_db_, tname_),
50          mods(mods_), it(mods.begin()), poslist(0)
51    { }
52
53    ~FlintModifiedPostList();
54
55    Xapian::doccount get_termfreq() const;
56
57    Xapian::docid get_docid() const;
58
59    Xapian::doclength get_doclength() const;
60
61    Xapian::termcount get_wdf() const;
62
63    PositionList *read_position_list();
64
65    PositionList *open_position_list() const;
66
67    PostList * next(Xapian::weight w_min);
68
69    PostList * skip_to(Xapian::docid desired_did, Xapian::weight w_min);
70
71    bool at_end() const;
72
73    std::string get_description() const;
74};
75
76#endif // XAPIAN_INCLUDED_FLINT_MODIFIEDPOSTLIST_H
Note: See TracBrowser for help on using the browser.