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.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 #include "common_headers.hpp" 00014 #include "RetrievalMethod.hpp" 00015 #include "RetMethodManager.hpp" 00016 #include "IndexManager.hpp" 00017 #include "DocScore.hpp" 00018 namespace lemur 00019 { 00020 namespace distrib 00021 { 00022 00024 00031 class DistSearchMethod { 00032 public: 00033 DistSearchMethod() {csindex = NULL; defrt = lemur::api::RetMethodManager::INQUERY; returnCount=1000;} 00034 DistSearchMethod(const lemur::api::Index* index, lemur::api::RetMethodManager::RetModel defmodel=lemur::api::RetMethodManager::INQUERY) { 00035 csindex = index; 00036 defrt = defmodel; 00037 } 00038 ~DistSearchMethod() {} 00039 00041 void setReturnCount(int retCount){returnCount=retCount;}; 00042 00044 void setIndex(const lemur::api::Index* index){csindex = index;} ; 00045 00047 void setDefaultRetMethod(lemur::api::RetMethodManager::RetModel rt) {defrt = rt;}; 00048 00050 00056 void scoreIndexSet(const lemur::api::Query &qry, const lemur::api::IndexedRealVector &indexset, 00057 DocScoreVector** results); 00058 00060 void scoreIndexSet(const lemur::api::Query &qry, const vector<string> &indexset, 00061 DocScoreVector** results); 00062 00064 static void indexToID(const lemur::api::Index* ind, const lemur::api::IndexedRealVector* ivec, 00065 DocScoreVector* dvec); 00066 00067 protected: 00069 void doSingleRetr(); 00070 00071 const lemur::api::Index* csindex; // the collection selection index 00072 lemur::api::RetMethodManager::RetModel defrt; // default retrieval method to use if no param is avail 00073 const lemur::api::Query* query; // the query we're currently working on 00074 DocScoreVector** allres; // where to store all results 00075 int reslen; // length of allres 00076 int returnCount;//the number of result should be returned 00077 }; 00078 } 00079 }