00001 /*========================================================================== 00002 * Copyright (c) 2001 Carnegie Mellon University. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.cs.cmu.edu/~lemur/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 00014 #ifndef _LEMURDBMANAGER_HPP 00015 #define _LEMURDBMANAGER_HPP 00016 00017 #include "DBManager.hpp" 00018 00019 #include "InvFPIndex.hpp" 00020 00021 #include "RetrievalMethod.hpp" 00022 #include "LemurMemParser.hpp" 00023 #include "RetMethodManager.hpp" 00024 00025 // All of these are available from RetrievalParameter directly 00026 // No need for an additional namespace. --dmf 01/16/2004 00027 #if 0 00028 00029 namespace LemurParameter { 00030 static RetMethodManager::RetModel mod; 00032 static String dbname; 00033 00035 static void get() { 00036 // default is KL divergence model 00037 mod = (RetMethodManager::RetModel) ParamGetInt("retModel", RetMethodManager::KL); 00038 dbname = ParamGetString("index"); 00039 RetrievalParameter::get(); 00040 } 00041 }; 00042 00043 #endif 00044 00047 class LemurDBManager : public DBManager { 00048 00049 public: 00052 void open(char * dbname); 00053 00055 results_t * query (char * query, int numdocs); 00056 00058 MemParser * getParser(); 00059 00061 doc_t * getDoc(docid_t docid); 00062 00064 void output(docid_t docid); 00066 void setOutputFile(char * filename); 00067 00069 void close(); 00070 00071 private: 00072 00073 Index * index; 00074 RetrievalMethod * model; 00075 ScoreAccumulator * accumulator; 00076 IndexedRealVector * results; 00077 LemurMemParser * parser; 00078 ofstream * outfile; 00079 00080 }; 00081 00082 #endif