hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SphinxDataSource.hpp
Go to the documentation of this file.
1 
14 #ifndef SPHINX_DATA_SOURCE_HPP
15 #define SPHINX_DATA_SOURCE_HPP
16 
17 #include <Poco/SAX/InputSource.h>
18 #include <Poco/DOM/Node.h>
19 
20 #include<iostream>
21 
22 namespace HCE
23 {
24 namespace sphinx
25 {
26 //-----------------------------------------------------------------------------
27 namespace sphinx_data_source_const
28 {
29  const std::string namespaceURITag = "http://sphinxsearch.com";
30 
31  const std::string docsetTag = "sphinx:docset";
32  const std::string schemaTag = "sphinx:schema";
33  const std::string fieldTag = "sphinx:field";
34  const std::string attrTag = "sphinx:attr";
35  const std::string documentTag = "sphinx:document";
36  const std::string nameAttrTag = "name";
37  const std::string weightAttrTag = "weight";
38  const std::string documentIdAttrTag = "id";
39 
40  const std::string hceParametersTag = "hce:parameters";
41  const std::string hceDocsTag = "hce:docs";
42  const std::string maxDocIdAttrTag = "max_doc_id";
43  const std::string documentsAttrTag = "documents";
44 
45 }
46 //-----------------------------------------------------------------------------
48 {
49 public:
50  SphinxDataSource(std::istream& istrSchema, std::istream& istrDocument);
51  virtual ~SphinxDataSource(void);
52 
53  bool Process(std::ostream& os);
54 
55  std::string getErrorMsg(void) const {return errorMsg;}
56  bool isError(void) const {return _IsError;}
57 
58  unsigned long long getMaxDocId(void) const {return maxDocId;}
59 private:
60  Poco::XML::InputSource sourceSchema;
61  Poco::XML::InputSource sourceDocument;
62  std::string errorMsg;
63  bool _IsError;
64  unsigned long long maxDocId;
65 private:
66  static void save(Poco::XML::Node* pNode, std::ostream& os);
67  friend std::ostream& operator << (std::ostream& os, const SphinxDataSource& dataSource) throw (Poco::Exception);
68 };
69 //-----------------------------------------------------------------------------
70 //-----------------------------------------------------------------------------
71 } // end namespace sphinx
72 } // end namespace HCE
73 
74 #endif // SPHINX_DATA_SOURCE_HPP