backends/quartz/quartz_termlist.h

Go to the documentation of this file.
00001 /* quartz_termlist.h: Termlists in quartz databases
00002  *
00003  * Copyright 1999,2000,2001 BrightStation PLC
00004  * Copyright 2002 Ananova Ltd
00005  * Copyright 2002,2003,2004,2006,2007 Olly Betts
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License as
00009  * published by the Free Software Foundation; either version 2 of the
00010  * License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00020  * USA
00021  */
00022 
00023 #ifndef OM_HGUARD_QUARTZ_TERMLIST_H
00024 #define OM_HGUARD_QUARTZ_TERMLIST_H
00025 
00026 #include <string>
00027 
00028 #include <xapian/types.h>
00029 #include "termlist.h"
00030 #include "btree.h"
00031 #include "database.h"
00032 
00033 using namespace std;
00034 
00035 class QuartzTermListTable : public Btree {
00036     public:
00051         QuartzTermListTable(string path_, bool readonly_)
00052             : Btree(path_ + "/termlist_", readonly_) { }
00053 
00064         void set_entries(Xapian::docid did,
00065                     Xapian::TermIterator t, const Xapian::TermIterator &t_end,
00066                     quartz_doclen_t doclen, bool store_termfreqs);
00067 
00071         void delete_termlist(Xapian::docid did);
00072 };
00073 
00076 class QuartzTermList : public TermList {
00077     private:
00078         // Prevent copying
00079         QuartzTermList(const QuartzTermList &);
00080         QuartzTermList & operator=(const QuartzTermList &);
00081 
00085         Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> this_db;
00086 
00087         Xapian::docid did;
00088 
00091         const Btree * table;
00092 
00097         string termlist_part;
00098 
00101         const char *pos;
00102 
00105         const char *end;
00106 
00109         bool have_finished;
00110 
00111 
00114         quartz_doclen_t doclen;
00115 
00118         Xapian::termcount termlist_size;
00119 
00122         string current_tname;
00123 
00126         Xapian::termcount current_wdf;
00127 
00132         bool has_termfreqs;
00133 
00140         mutable Xapian::doccount current_termfreq;
00141 
00144         Xapian::doccount doccount;
00145 
00146     public:
00149         QuartzTermList(Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> this_db_,
00150                        const Btree * table_,
00151                        Xapian::docid did_,
00152                        Xapian::doccount doccount_);
00153 
00160         quartz_doclen_t get_doclength() const;
00161 
00166         Xapian::termcount get_approx_size() const;
00167 
00175         TermList * next();
00176 
00179         bool at_end() const;
00180 
00183         string get_termname() const;
00184 
00187         Xapian::termcount get_wdf() const;
00188 
00194         Xapian::doccount get_termfreq() const;
00195 
00197         void accumulate_stats(Xapian::Internal::ExpandStats & stats) const;
00198 
00199         Xapian::termcount positionlist_count() const;
00200 
00201         Xapian::PositionIterator positionlist_begin() const;
00202 };
00203 
00204 #endif /* OM_HGUARD_QUARTZ_TERMLIST_H */

Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.