Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

LocalQueryServer.hpp

Go to the documentation of this file.
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 // LocalQueryServer
00015 //
00016 // 15 March 2004 -- tds
00017 //
00018 // Allows a QueryEnvironment to run queries against a
00019 // local connection (without doing a network hop).
00020 // This is especially useful for testing.
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       // hold the value of the Parameter optimize, so only one call to
00040       // get is required. Globally disable query optimization if
00041       // the parameter is false.
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       // query
00054       QueryServerResponse* runQuery( std::vector<indri::lang::Node*>& roots, int resultsRequested, bool optimize );
00055 
00056       // single document queries
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       // batch queries
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       // terms
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       // fields
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       // documents
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       // vector
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

Generated on Tue Jun 15 11:02:54 2010 for Lemur by doxygen 1.3.4