1 /** @file glass_metadata.h
2 * @brief Access to metadata for a glass database.
4 /* Copyright (C) 2005,2007,2008,2009,2011,2017 Olly Betts
5 * Copyright (C) 2008 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_GLASS_METADATA_H
23 #define XAPIAN_INCLUDED_GLASS_METADATA_H
25 #include <xapian/intrusive_ptr.h>
26 #include <xapian/database.h>
27 #include <xapian/types.h>
29 #include "backends/alltermslist.h"
30 #include "glass_table.h"
31 #include "api/termlist.h"
37 class GlassMetadataTermList
: public AllTermsList
{
38 /// Copying is not allowed.
39 GlassMetadataTermList(const GlassMetadataTermList
&);
41 /// Assignment is not allowed.
42 void operator=(const GlassMetadataTermList
&);
44 /// Keep a reference to our database to stop it being deleted.
45 Xapian::Internal::intrusive_ptr
<const Xapian::Database::Internal
> database
;
47 /** A cursor which runs through the postlist table reading metadata keys.
51 /** The prefix that all returned keys must have.
56 GlassMetadataTermList(Xapian::Internal::intrusive_ptr
<const Xapian::Database::Internal
> database_
,
57 GlassCursor
* cursor_
, const std::string
&prefix_
);
59 ~GlassMetadataTermList();
61 Xapian::termcount
get_approx_size() const;
63 /** Returns the current termname.
65 * Either next() or skip_to() must have been called before this
66 * method can be called.
68 std::string
get_termname() const;
70 /** Return the term frequency for the term at the current position.
72 * Not meaningful for a GlassMetadataTermList.
74 Xapian::doccount
get_termfreq() const;
76 /** Return the collection frequency for the term at the current position.
78 * Not meaningful for a GlassMetadataTermList.
80 Xapian::termcount
get_collection_freq() const;
82 /// Advance to the next term in the list.
85 /// Advance to the first key which is >= @a key.
86 TermList
* skip_to(const std::string
&key
);
88 /// True if we're off the end of the list
92 #endif // XAPIAN_INCLUDED_GLASS_METADATA_H