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 "IndexTypes.hpp" 00026 #include <vector> 00027 namespace indri 00028 { 00029 namespace server 00030 { 00031 00032 class QueryServerResponse { 00033 public: 00034 virtual ~QueryServerResponse() {}; 00035 virtual indri::infnet::InferenceNetwork::MAllResults& getResults() = 0; 00036 }; 00037 00038 class QueryServerDocumentsResponse { 00039 public: 00040 virtual ~QueryServerDocumentsResponse() {}; 00041 virtual std::vector<indri::api::ParsedDocument*>& getResults() = 0; 00042 }; 00043 00044 class QueryServerMetadataResponse { 00045 public: 00046 virtual ~QueryServerMetadataResponse() {}; 00047 virtual std::vector<std::string>& getResults() = 0; 00048 }; 00049 00050 class QueryServerVectorsResponse { 00051 public: 00052 virtual ~QueryServerVectorsResponse() {}; 00053 virtual std::vector<indri::api::DocumentVector*>& getResults() = 0; 00054 }; 00055 00056 class QueryServerDocumentIDsResponse { 00057 public: 00058 virtual ~QueryServerDocumentIDsResponse() {}; 00059 virtual std::vector<lemur::api::DOCID_T>& getResults() = 0; 00060 }; 00061 00062 00063 class QueryServer { 00064 public: 00065 virtual ~QueryServer() {}; 00066 virtual QueryServerResponse* runQuery( std::vector<indri::lang::Node*>& roots, int resultsRequested, bool optimize ) = 0; 00067 virtual QueryServerDocumentsResponse* documents( const std::vector<lemur::api::DOCID_T>& documentIDs ) = 0; 00068 virtual QueryServerMetadataResponse* documentMetadata( const std::vector<lemur::api::DOCID_T>& documentIDs, const std::string& attributeName ) = 0; 00069 virtual QueryServerDocumentsResponse* documentsFromMetadata( const std::string& attributeName, const std::vector<std::string>& attributeValues ) = 0; 00070 virtual QueryServerDocumentIDsResponse* documentIDsFromMetadata( const std::string& attributeName, const std::vector<std::string>& attributeValues ) = 0; 00071 virtual QueryServerMetadataResponse* pathNames( const std::vector<lemur::api::DOCID_T>& documentIDs, const std::vector<int>& pathBegins, const std::vector<int>& pathEnds ) = 0; 00072 00073 // terms 00074 virtual INT64 termCount() = 0; 00075 virtual INT64 termCount( const std::string& term ) = 0; 00076 virtual INT64 stemCount( const std::string& stem ) = 0; 00077 00078 virtual std::string termName( lemur::api::TERMID_T term ) = 0; 00079 virtual lemur::api::TERMID_T termID( const std::string& term ) = 0; 00080 00081 // fields 00082 virtual std::vector<std::string> fieldList() = 0; 00083 virtual INT64 termFieldCount( const std::string& term, const std::string& field ) = 0; 00084 virtual INT64 stemFieldCount( const std::string& stem, const std::string& field ) = 0; 00085 00086 // documents 00087 virtual int documentLength( lemur::api::DOCID_T documentID ) = 0; 00088 virtual INT64 documentCount() = 0; 00089 virtual INT64 documentCount( const std::string& term ) = 0; 00090 virtual INT64 documentStemCount( const std::string& term ) = 0; 00091 00092 // document vector 00093 virtual QueryServerVectorsResponse* documentVectors( const std::vector<lemur::api::DOCID_T>& documentIDs ) = 0; 00094 00095 // max wildcard terms 00096 virtual void setMaxWildcardTerms(int maxTerms) = 0; 00097 }; 00098 } 00099 } 00100 00101 #endif // INDRI_QUERYSERVER_HPP 00102