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 00026 namespace LemurParameter { 00027 static RetMethodManager::RetModel mod; 00029 static String dbname; 00030 00032 static void get() { 00033 // default is KL divergence model 00034 mod = (RetMethodManager::RetModel) ParamGetInt("retModel", RetMethodManager::KL); 00035 dbname = ParamGetString("index"); 00036 RetrievalParameter::get(); 00037 } 00038 }; 00039 00043 class LemurDBManager : public DBManager { 00044 00045 public: 00048 void open(char * dbname); 00049 00051 results_t * query (char * query, int numdocs); 00052 00054 MemParser * getParser(); 00055 00057 doc_t * getDoc(docid_t docid); 00058 00060 void output(docid_t docid); 00062 void setOutputFile(char * filename); 00063 00065 void close(); 00066 00067 private: 00068 00069 Index * index; 00070 RetrievalMethod * model; 00071 ScoreAccumulator * accumulator; 00072 IndexedRealVector * results; 00073 LemurMemParser * parser; 00074 ofstream * outfile; 00075 00076 }; 00077 00078 #endif