00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef INDRI_LOCALQUERYSERVER_HPP
00024 #define INDRI_LOCALQUERYSERVER_HPP
00025
00026 #include "indri/QueryServer.hpp"
00027 #include "indri/Collection.hpp"
00028 #include "indri/Repository.hpp"
00029 #include "indri/DocumentVector.hpp"
00030 #include "indri/ListCache.hpp"
00031 namespace indri
00032 {
00034 namespace server
00035 {
00036
00037 class LocalQueryServer : public QueryServer {
00038 private:
00039
00040
00041
00042 bool _optimizeParameter;
00043 indri::collection::Repository& _repository;
00044 indri::lang::ListCache _cache;
00045
00046 int _maxWildcardMatchesPerTerm;
00047
00048 indri::index::Index* _indexWithDocument( indri::collection::Repository::index_state& state, lemur::api::DOCID_T documentID );
00049
00050 public:
00051 LocalQueryServer( indri::collection::Repository& repository );
00052
00053
00054 QueryServerResponse* runQuery( std::vector<indri::lang::Node*>& roots, int resultsRequested, bool optimize );
00055
00056
00057 indri::api::ParsedDocument* document( lemur::api::DOCID_T documentID );
00058 std::string documentMetadatum( lemur::api::DOCID_T documentID, const std::string& attributeName );
00059
00060 QueryServerDocumentIDsResponse* documentIDsFromMetadata( const std::string& attributeName, const std::vector<std::string>& attributeValues );
00061 QueryServerDocumentsResponse* documentsFromMetadata( const std::string& attributeName, const std::vector<std::string>& attributeValues );
00062
00063
00064 QueryServerDocumentsResponse* documents( const std::vector<lemur::api::DOCID_T>& documentIDs );
00065 QueryServerMetadataResponse* documentMetadata( const std::vector<lemur::api::DOCID_T>& documentIDs, const std::string& attributeName );
00066
00067 QueryServerMetadataResponse* pathNames( const std::vector<lemur::api::DOCID_T>& documentIDs, const std::vector<int>& pathBegins, const std::vector<int>& pathEnds );
00068
00069
00070 INT64 termCount();
00071 INT64 termCount( const std::string& term );
00072 INT64 stemCount( const std::string& stem );
00073 std::string termName( lemur::api::TERMID_T term );
00074 lemur::api::TERMID_T termID( const std::string& term );
00075
00076
00077 std::vector<std::string> fieldList();
00078 INT64 termFieldCount( const std::string& term, const std::string& field );
00079 INT64 stemFieldCount( const std::string& stem, const std::string& field );
00080
00081
00082 int documentLength( lemur::api::DOCID_T documentID );
00083 INT64 documentCount();
00084 INT64 documentCount( const std::string& term );
00085 INT64 documentStemCount( const std::string& term );
00086
00087
00088 QueryServerVectorsResponse* documentVectors( const std::vector<lemur::api::DOCID_T>& documentIDs );
00089
00094 void setMaxWildcardTerms(int maxTerms);
00095
00096 };
00097 }
00098 }
00099
00100 #endif // INDRI_LOCALQUERYSERVER_HPP