00001 00002 // 00003 // ContextSimpleCountAccumulator 00004 // 00005 // 14 December 2004 -- tds 00006 // 00007 // Unlike the ContextCountAccumulator, which counts occurrences of 00008 // terms in a very general way, this node uses knowledge about the 00009 // query tree to extract counts directly from the index. 00010 // 00011 // This node is placed into the query tree by the 00012 // ContextSimpleCountCollectorCopier. 00013 // 00014 00015 #ifndef INDRI_CONTEXTSIMPLECOUNTACCUMULATOR_HPP 00016 #define INDRI_CONTEXTSIMPLECOUNTACCUMULATOR_HPP 00017 00018 #include "indri/Index.hpp" 00019 #include "indri/EvaluatorNode.hpp" 00020 #include <string> 00021 #include <vector> 00022 00023 namespace indri 00024 { 00025 namespace infnet 00026 { 00027 00028 class ContextSimpleCountAccumulator : public EvaluatorNode { 00029 private: 00030 std::string _name; 00031 00032 std::vector<std::string> _terms; 00033 std::string _field; 00034 std::string _context; 00035 00036 UINT64 _occurrences; 00037 UINT64 _size; 00038 lemur::api::DOCID_T _maximumDocument; 00039 int _documentOccurrences; 00040 int _documentCount; 00041 00042 EvaluatorNode::MResults _results; 00043 00044 void _computeCounts( indri::index::Index& index ); 00045 00046 public: 00047 ContextSimpleCountAccumulator( const std::string& nodeName, 00048 const std::vector<std::string>& terms, 00049 const std::string& field, 00050 const std::string& context ); 00051 00052 const std::string& getName() const; 00053 const EvaluatorNode::MResults& getResults(); 00054 00055 int getDocumentOccurrences() const ; 00056 int getDocumentCount() const ; 00057 00058 void indexChanged( indri::index::Index& index ); 00059 void evaluate( lemur::api::DOCID_T documentID, int documentLength ); 00060 lemur::api::DOCID_T nextCandidateDocument(); 00061 }; 00062 } 00063 } 00064 00065 00066 #endif // INDRI_CONTEXTSIMPLECOUNTACCUMULATOR_HPP