hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SphinxSearchInterface.hpp
Go to the documentation of this file.
1 
15 #ifndef SPHINX_SEARCH_INTERFACE_HPP
16 #define SPHINX_SEARCH_INTERFACE_HPP
17 
18 #include <iostream>
19 #include <time.h>
20 #include <sys/time.h>
21 
22 namespace HCE
23 {
24 namespace sphinx
25 {
26 class SphinxInputJsonMessage;
27 class SphinxOutputJsonMessage;
28 //-----------------------------------------------------------------------------
29 namespace sphinx_search_const
30 {
31  const bool searchdStart = true;
32  const bool searchdNotStart = false;
33  const bool searchdStop = true;
34  const bool searchdNotStop = false;
35 
36  const int startStopSearchdLimit = 10;
37  const std::string defaultHost = "127.0.0.1";
38  const unsigned int defaultPort = 9312;
39  const unsigned int maxAllowedPort = 10312;
40  const std::string searchdListen = "searchd.listen";
41  const std::string searchdMaxMatches = "searchd.max_matches";
42  const std::string searchdLogName = "searchd.log";
43  const std::string searchdLogFile = "searchd.log";
44  const std::string searchdPidName = "searchd.pid_file";
45  const std::string searchdPidFileName = "searchd";
46  const std::string searchdPidFileExt = "pid";
47  const std::string searchdQueryLogName = "searchd.query_log";
48  const std::string searchdQueryLogFile = "query.log";
49 
50  const std::string searchdGoodStatusFlag = "searchd status";
51 
52  const std::string indexNameField = "index";
53  const std::string sourceNameField = "source";
54  const std::string pathNameField = "path";
55  const std::string xmlpipeCommandNameField = "xmlpipe_command";
56 
57  const std::string branchPropertyFile = "branch.property";
58  const std::string branchConfigFile = "branch.cfg";
59  const std::string sphinxTemplateFile = "sphinx.template";
60  const std::string sphinxPropertyFile = "sphinx.property";
61  const std::string sphinxSchemaFile = "schema.xml";
62  const std::string sphinxConfigName = "sphinx.conf";
63 
64 // const std::string defaultIndexName = "default_index";
65  const std::string defaultBranchName = "default_branch";
66 
67  const std::string defaultHomeDir = ".";
68  const std::string defaultDataDir = "data";
69  const std::string defaultRunDir = "run";
70  const std::string defaultLogDir = "log";
71  const std::string defaultEtcDir = "etc";
72 
73  const std::string moduleName = "Sphinx";
74 }
75 //-----------------------------------------------------------------------------
77 {
78 public:
80  virtual ~SphinxSearchInterface(void) {}
81 
82  virtual std::string Process(const std::string& json)=0;
84 
85  void setErrorMsg(const std::string& errorMsg_) {errorMsg=errorMsg_;}
86  std::string getErrorMsg(void) const {return errorMsg;}
87 
88  void setErrorCode(unsigned int errorCode_) {errorCode=errorCode_;}
89  unsigned int getErrorCode(void) const {return errorCode;}
90 
91  void isError(bool isError_) {_isError=isError_;}
92  bool isError(void) const {return _isError;}
93 
94 protected:
95  std::string errorMsg;
96  unsigned int errorCode;
97  bool _isError;
98 public:
99  static bool insensitiveCompare(const std::string& lhs, const std::string& rhs);
100  static size_t getTimeInterval(timeval& start, timeval& stop);
101 };
102 //-----------------------------------------------------------------------------
103 //-----------------------------------------------------------------------------
104 } // end namespace sphinx
105 } // end namespace HCE
106 
107 #endif // SPHINX_SEARCH_INTERFACE_HPP