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 // NetworkServerProxy 00015 // 00016 // 23 March 2004 -- tds 00017 // 00018 00019 #ifndef INDRI_NETWORKSERVERPROXY_HPP 00020 #define INDRI_NETWORKSERVERPROXY_HPP 00021 00022 #include "indri/XMLNode.hpp" 00023 #include "indri/XMLWriter.hpp" 00024 #include "indri/QueryResponseUnpacker.hpp" 00025 #include "indri/QueryServer.hpp" 00026 #include "indri/Packer.hpp" 00027 #include "indri/NetworkMessageStream.hpp" 00028 #include "indri/Buffer.hpp" 00029 namespace indri 00030 { 00031 namespace server 00032 { 00033 class NetworkServerProxy : public QueryServer { 00034 private: 00035 indri::net::NetworkMessageStream* _stream; 00036 00037 INT64 _numericRequest( indri::xml::XMLNode* node ); 00038 std::string _stringRequest( indri::xml::XMLNode* node ); 00039 00040 public: 00041 NetworkServerProxy( indri::net::NetworkMessageStream* stream ); 00042 00043 QueryServerResponse* runQuery( std::vector<indri::lang::Node*>& roots, int resultsRequested, bool optimize ); 00044 QueryServerDocumentsResponse* documents( const std::vector<lemur::api::DOCID_T>& documentIDs ); 00045 QueryServerMetadataResponse* documentMetadata( const std::vector<lemur::api::DOCID_T>& documentIDs, const std::string& attributeName ); 00046 00047 QueryServerDocumentIDsResponse* documentIDsFromMetadata( const std::string& attributeName, const std::vector<std::string>& attributeValues ); 00048 QueryServerDocumentsResponse* documentsFromMetadata( const std::string& attributeName, const std::vector<std::string>& attributeValues ); 00049 00050 QueryServerMetadataResponse* pathNames( const std::vector<lemur::api::DOCID_T>& documentIDs, const std::vector<int>& pathBegins, const std::vector<int>& pathEnds ); 00051 00052 // terms -- implemented (but not on stub) 00053 INT64 termCount(); 00054 INT64 termCount( int term ); 00055 INT64 termCount( const std::string& term ); 00056 INT64 stemCount( const std::string& stem ); 00057 std::string termName( lemur::api::TERMID_T term ); 00058 lemur::api::TERMID_T termID( const std::string& term ); 00059 00060 // fields 00061 std::vector<std::string> fieldList(); // unimpl 00062 INT64 termFieldCount( const std::string& term, const std::string& field ); 00063 INT64 stemFieldCount( const std::string& stem, const std::string& field ); 00064 00065 // documents 00066 int documentLength( lemur::api::DOCID_T documentID ); 00067 INT64 documentCount(); 00068 INT64 documentCount( const std::string& term ); 00069 INT64 documentStemCount( const std::string& term ); 00070 00071 // document vector 00072 QueryServerVectorsResponse* documentVectors( const std::vector<lemur::api::DOCID_T>& documentIDs ); 00073 00074 void setMaxWildcardTerms(int maxTerms); 00075 }; 00076 } 00077 } 00078 00079 #endif // INDRI_NETWORKSERVERPROXY_HPP