root / tags / 1.0.8 / xapian-core / backends / flint / flint_termlisttable.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_termlisttable.h
2 * @brief Subclass of FlintTable which holds termlists.
3 */
4/* Copyright (C) 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_TERMLISTTABLE_H
22#define XAPIAN_INCLUDED_FLINT_TERMLISTTABLE_H
23
24#include <xapian/types.h>
25
26#include "flint_table.h"
27#include "flint_utils.h"
28
29#include <string>
30
31namespace Xapian {
32class Document;
33}
34
35class FlintTermListTable : public FlintTable {
36  public:
37    /** Create a new FlintTermListTable object.
38     *
39     *  This method does not create or open the table on disk - you
40     *  must call the create() or open() methods respectively!
41     *
42     *  @param dbdir        The directory the flint database is stored in.
43     *  @param readonly     true if we're opening read-only, else false.
44     */
45    FlintTermListTable(std::string dbdir, bool readonly)
46        : FlintTable(dbdir + "/termlist.", readonly, Z_DEFAULT_STRATEGY) { }
47
48    /** Set the termlist data for document @a did.
49     *
50     *  Any existing data is replaced.
51     *
52     *  @param did      The docid to set the termlist data for.
53     *  @param doc      The Xapian::Document object to read term data from.
54     *  @param doclen   The document length.
55     */
56    void set_termlist(Xapian::docid did, const Xapian::Document & doc,
57                      flint_doclen_t doclen);
58
59    /** Delete the termlist data for document @a did.
60     *
61     *  @param did  The docid to delete the termlist data for.
62     */
63    void delete_termlist(Xapian::docid did) { del(flint_docid_to_key(did)); }
64
65    /// Returns the document length for document @a did.
66    flint_doclen_t get_doclength(Xapian::docid did) const;
67};
68
69#endif // XAPIAN_INCLUDED_FLINT_TERMLISTTABLE_H
Note: See TracBrowser for help on using the browser.