backends/flint/flint_document.cc

Go to the documentation of this file.
00001 /* flint_document.cc: Implementation of document for Flint database
00002  *
00003  * ----START-LICENCE----
00004  * Copyright 1999,2000,2001 BrightStation PLC
00005  * Copyright 2002 Ananova Ltd
00006  * Copyright 2003,2004 Olly Betts
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00021  * USA
00022  * -----END-LICENCE-----
00023  */
00024 
00025 #include <config.h>
00026 #include "omdebug.h"
00027 #include "flint_database.h"
00028 #include "flint_document.h"
00029 #include "flint_values.h"
00030 #include "flint_record.h"
00031 
00035 FlintDocument::FlintDocument(Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> database_,
00036                                const FlintValueTable *value_table_,
00037                                const FlintRecordTable *record_table_,
00038                                Xapian::docid did_, bool lazy)
00039         : Xapian::Document::Internal(database_.get(), did_),
00040           database(database_),
00041           value_table(value_table_),
00042           record_table(record_table_)
00043 {
00044     DEBUGCALL(DB, void, "FlintDocument", "[database_], " << value_table_ << ", " << record_table_ << ", " << did_ << ", " << lazy);
00045     // FIXME: this should work but isn't great - in fact I wonder if
00046     // we should cache the results anyway...
00047     if (!lazy) (void)record_table->get_record(did);
00048 }
00049 
00052 FlintDocument::~FlintDocument()
00053 {
00054     DEBUGCALL(DB, void, "~FlintDocument", "");
00055 }
00056 
00061 string
00062 FlintDocument::do_get_value(Xapian::valueno valueid) const
00063 {
00064     DEBUGCALL(DB, string, "FlintDocument::do_get_value", valueid);
00065     string retval;
00066     value_table->get_value(retval, did, valueid);
00067     RETURN(retval);
00068 }
00069 
00072 map<Xapian::valueno, string>
00073 FlintDocument::do_get_all_values() const
00074 {
00075     DEBUGCALL(DB, void, "FlintDocument::do_get_all_values", "");
00076     map<Xapian::valueno, string> value_map;
00077     value_table->get_all_values(value_map, did);
00078     return value_map;
00079 }
00080 
00083 string
00084 FlintDocument::do_get_data() const
00085 {
00086     DEBUGCALL(DB, string, "FlintDocument::do_get_data", "");
00087     RETURN(record_table->get_record(did));
00088 }

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