00001 /*========================================================================== 00002 * Copyright (c) 2004 University of Massachusetts. 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 // 00014 // QueryServer 00015 // 00016 // 15 March 2004 -- tds 00017 // 00018 00019 #ifndef INDRI_QUERYSERVER_HPP 00020 #define INDRI_QUERYSERVER_HPP 00021 00022 #include "indri/QuerySpec.hpp" 00023 #include "indri/InferenceNetwork.hpp" 00024 #include "indri/DocumentVector.hpp" 00025 #include <vector> 00026 00027 class QueryServerResponse { 00028 public: 00029 virtual InferenceNetwork::MAllResults& getResults() = 0; 00030 }; 00031 00032 class QueryServerDocumentsResponse { 00033 public: 00034 virtual std::vector<ParsedDocument*>& getResults() = 0; 00035 }; 00036 00037 class QueryServerMetadataResponse { 00038 public: 00039 virtual std::vector<std::string>& getResults() = 0; 00040 }; 00041 00042 class QueryServerVectorsResponse { 00043 public: 00044 virtual std::vector<DocumentVector*>& getResults() = 0; 00045 }; 00046 00047 class QueryServer { 00048 public: 00049 virtual ~QueryServer() {}; 00050 virtual QueryServerResponse* runQuery( std::vector<indri::lang::Node*>& roots, int resultsRequested, bool optimize ) = 0; 00051 virtual QueryServerDocumentsResponse* documents( const std::vector<int>& documentIDs ) = 0; 00052 virtual QueryServerMetadataResponse* documentMetadata( const std::vector<int>& documentIDs, const std::string& attributeName ) = 0; 00053 00054 // terms 00055 virtual INT64 termCount() = 0; 00056 virtual INT64 termCount( int term ) = 0; 00057 virtual INT64 termCount( const std::string& term ) = 0; 00058 virtual INT64 stemCount( const std::string& stem ) = 0; 00059 00060 virtual std::string termName( int term ) = 0; 00061 virtual int termID( const std::string& term ) = 0; 00062 00063 // fields 00064 virtual std::vector<std::string> fieldList() = 0; 00065 virtual INT64 termFieldCount( int term, const std::string& field ) = 0; 00066 virtual INT64 termFieldCount( const std::string& term, const std::string& field ) = 0; 00067 virtual INT64 stemFieldCount( const std::string& stem, const std::string& field ) = 0; 00068 00069 // documents 00070 virtual int documentLength( int documentID ) = 0; 00071 virtual INT64 documentCount() = 0; 00072 virtual INT64 documentCount( const std::string& term ) = 0; 00073 00074 // document vector 00075 virtual QueryServerVectorsResponse* documentVectors( const std::vector<int>& documentIDs ) = 0; 00076 }; 00077 00078 #endif // INDRI_QUERYSERVER_HPP 00079