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 #ifndef _RETRIEVALMETHOD_HPP 00014 #define _RETRIEVALMETHOD_HPP 00015 00016 00017 #include "Index.hpp" 00018 #include "WeightedIDSet.hpp" 00019 #include "IndexedReal.hpp" 00020 00021 //------------------------------------------------------------ 00022 // Abstract Interface for A Query 00023 //------------------------------------------------------------ 00024 00026 class Query { 00027 public: 00028 virtual ~Query() {} 00029 00030 virtual const string& id() const { return qid; } 00031 virtual void id(const string& str) { qid = str; } 00032 00033 protected: 00034 string qid; 00035 }; 00036 00038 00039 class QueryRep { 00040 public: 00041 virtual ~QueryRep(){} 00042 }; 00043 00044 00045 //------------------------------------------------------------ 00046 // Abstract Interface for Feedback Document Subset 00047 //------------------------------------------------------------ 00048 00050 typedef WeightedIDSet DocIDSet; 00051 00052 00053 //------------------------------------------------------------ 00054 // Abstract Interface for A Retrieval Method/Model 00055 //------------------------------------------------------------ 00056 00057 00058 00069 class RetrievalMethod { 00070 public: 00071 RetrievalMethod(const Index &collectionIndex) : ind(collectionIndex) {} 00072 virtual ~RetrievalMethod() {} 00073 00075 virtual QueryRep *computeQueryRep(const Query &qry)=0; 00076 00078 virtual double scoreDoc(const QueryRep &qry, DOCID_T docID)=0; 00079 00081 00084 virtual void scoreDocSet(const QueryRep &qry, const DocIDSet &docSet, IndexedRealVector &results); 00085 00087 00094 virtual void scoreCollection(const QueryRep &qry, IndexedRealVector &results); 00095 00097 virtual void updateQuery (QueryRep &qryRep, const DocIDSet &relDocs) = 0; 00098 00099 protected: 00100 const Index &ind; 00101 }; 00102 00103 #endif /* _RETRIEVALMETHOD_HPP */ 00104 00105 00106 00107 00108 00109 00110 00111 00112