1 #include <gtest/gtest.h>
30 printSuccess(
"Serialize IndexCreate");
33 msgManage->setCommandString(
"INDEX_CREATE");
34 msgManage->setCommandOptionsString(json);
35 ASSERT_TRUE(msgManage->serialize(json));
36 printSuccess(
"Serialize SphinxInputJsonMessageManage");
41 std::stringstream str;
45 std::cout <<
"ret: '" << ret <<
"'\n";
47 EXPECT_FALSE(ret.empty());
51 ASSERT_FALSE(outputJsonMessage.
isError());
52 ASSERT_TRUE(outputJsonMessage.
getData().empty());
54 printSuccess(
"Test command INDEX_CREATE");
63 printSuccess(
"Serialize IndexCheck");
66 msgManage->setCommandString(
"INDEX_CHECK");
67 msgManage->setCommandOptionsString(json);
68 ASSERT_TRUE(msgManage->serialize(json));
69 printSuccess(
"Serialize SphinxInputJsonMessageManage");
74 std::stringstream str;
78 std::cout <<
"ret: '" << ret <<
"'\n";
80 EXPECT_FALSE(ret.empty());
84 ASSERT_FALSE(outputJsonMessage.
isError());
86 ASSERT_TRUE(outputJsonMessage.
getData()==((existed)?
"1":
"0"));
88 printSuccess(
"Test command INDEX_CHECK");
94 dataContent <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<sphinx:docset xmlns:sphinx=\"http://sphinxsearch.com\">\n<sphinx:document id=\"123\">\n"
95 <<
"<title><![CDATA[[- Information interchange - Representation of dates and times. A discussion of ISO 8601 has been written by Markus Kuhn. ISO 8601 describes a large number of date/time formats. For example it defines Basic Format, without punctuation, and Extended Format, with punctuation, and it allows elements to be omitted. This profile defines a restricted range of formats, all of which are valid ISO 8601 dates and times. The aim is to simplify the use of ISO 8601 in World Wide Web-related standards, and to avoid the need for the developers and users of these standards to obtain copies of ISO 8601 itself.]]></title>\n"
96 <<
"<h><![CDATA[[time, so this profile defines six levels. Standards that reference this profile should specify one or more of these granularities. If a given standard allows more than one granularity, it should specify the meaning of the dates and times with reduced precision, for example, the result of comparing two dates with different precisions. The formats are as follows. Exactly the components shown here must be present, with exactly this punctuation. Note that the \"T\" appears literally in the string, to indicate the beginning of the time element, as specified in ISO 8601. Year: YYYY (eg 1997) Year and month: YYYY-MM (eg 1997-07)]]></h>\n"
97 <<
"<cdate>123</cdate>\n"
98 <<
"</sphinx:document>\n"
99 <<
"\n<sphinx:document id=\"53\">\n"
100 <<
"<title><![CDATA[[- Information interchange - ISO 8601 describes a large , and Extended Format, with punctuation, and it allows elements to be omitted. This profile defines a restricted range of formats, all of which are valid ISO 8601 dates and times. The aim is to simplify the use of ISO 8601 in World Wide Web-related standards, and to avoid the need for the developers and users of these standards to obtain copies of ISO 8601 itself.]]></title>\n"
101 <<
"<h><![CDATA[[time, so this profile defines six levels. omparing two dates with different precisions. The formats are as follows. Exactly the components shown here must be present, with exactly this punctuation. Note that the \"T\" appears literally in the string, to indicate the beginning of the time element, as specified in ISO 8601. Year: YYYY (eg 1997) Year and month: YYYY-MM (eg 1997-07)]]></h>\n"
102 <<
"<cdate>53</cdate>\n"
103 <<
"</sphinx:document>\n"
104 <<
"\n<sphinx:document id=\"133\">\n"
105 <<
"<title><![CDATA[[ There are more differences between 'gcc' and 'g++' than only the standard libraries, so gcc -lstdc++ will still not get you the same behavior as g++. We put all of that language-specific behavior into its own driver .]]></title>\n"
106 <<
"<h><![CDATA[[There are more differences between 'gcc' and 'g++' than only the standard libraries, so gcc -lstdc++ will still not get you the same behavior as g++. We put all of that language-specific behavior into its own driver ]]></h>\n"
107 <<
"<cdate>133</cdate>\n"
108 <<
"</sphinx:document>\n</sphinx:docset>";
120 ASSERT_TRUE(indexStoreDataFile.
serialize(json));
121 printSuccess(
"Serialize IndexStoreDataFile");
124 msgManage->setCommandString(
"INDEX_STORE_DATA_FILE");
125 msgManage->setCommandOptionsString(json);
126 ASSERT_TRUE(msgManage->serialize(json));
127 printSuccess(
"Serialize SphinxInputJsonMessageManage");
132 std::stringstream str;
136 std::cout <<
"ret: '" << ret <<
"'\n";
141 if (!dataContent.empty())
147 std::ifstream ifs(file.c_str());
148 ASSERT_TRUE(ifs.is_open());
150 std::stringstream fileContent;
151 fileContent << ifs.rdbuf();
155 ASSERT_TRUE(dataContent == fileContent.str());
158 ASSERT_FALSE(outputJsonMessage.
isError());
166 ASSERT_TRUE(!outputJsonMessage.isError());
167 ASSERT_TRUE(outputJsonMessage.getErrorCode()!=
NO_ERROR);
169 printSuccess(
"Test command INDEX_STORE_DATA_FILE");
174 std::string
dataContent =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<sphinx:docset xmlns:sphinx=\"http://sphinxsearch.com\">\n<sphinx:schema>\n<sphinx:field name=\"title\"/>\n<sphinx:field name=\"h\"/>\n<sphinx:attr name=\"cdate\" type=\"timestamp\"/>\n</sphinx:schema>\n</sphinx:docset>";
184 ASSERT_TRUE(indexStoreSchemaFile.
serialize(json));
185 printSuccess(
"Serialize IndexStoreSchemaFile");
188 msgManage->setCommandString(
"INDEX_STORE_SCHEMA_FILE");
189 msgManage->setCommandOptionsString(json);
190 ASSERT_TRUE(msgManage->serialize(json));
191 printSuccess(
"Serialize SphinxInputJsonMessageManage");
196 std::stringstream str;
200 std::cout <<
"ret: '" << ret <<
"'\n";
205 if (!dataContent.empty())
208 std::ifstream ifs(file.c_str());
209 ASSERT_TRUE(ifs.is_open());
211 std::stringstream fileContent;
212 fileContent << ifs.rdbuf();
215 ASSERT_TRUE(dataContent == fileContent.str());
218 ASSERT_TRUE(!outputJsonMessage.
isError());
220 printSuccess(
"Test command INDEX_STORE_SCHEMA_FILE");
229 for (
size_t i=0;i<branches.size();++i)
232 ASSERT_TRUE(indexRebuild.
serialize(json));
236 printSuccess(
"Serialize IndexRebuild");
239 msgManage->setCommandString(
"INDEX_REBUILD");
240 msgManage->setCommandOptionsString(json);
241 ASSERT_TRUE(msgManage->serialize(json));
242 printSuccess(
"Serialize SphinxInputJsonMessageManage");
247 std::stringstream str;
251 std::cout <<
"ret: '" << ret <<
"'\n";
253 std::cout <<
"Error: '" << fObj.
getErrorMsg() <<
"'\n";
256 ASSERT_TRUE(!outputJsonMessage.
isError());
257 if (!outputJsonMessage.
getData().empty())
258 std::cout <<
"outputJsonMessage.getData(): '" << outputJsonMessage.
getData() <<
"'\n";
259 ASSERT_TRUE(outputJsonMessage.
getData().empty());
261 printSuccess(
"Test command INDEX_REBUILD");
271 ASSERT_TRUE(indexSetDataDir.
serialize(json));
272 printSuccess(
"Serialize IndexSetDataDir");
275 msgManage->setCommandString(
"INDEX_SET_DATA_DIR");
276 msgManage->setCommandOptionsString(json);
277 ASSERT_TRUE(msgManage->serialize(json));
278 printSuccess(
"Serialize SphinxInputJsonMessageManage");
283 std::stringstream str;
287 std::cout <<
"ret: '" << ret <<
"'\n";
292 ASSERT_TRUE(!outputJsonMessage.
isError());
293 ASSERT_TRUE(outputJsonMessage.
getData().empty());
295 printSuccess(
"Test command INDEX_SET_DATA_DIR");
304 printSuccess(
"Serialize IndexStart");
307 msgManage->setCommandString(
"INDEX_START");
308 msgManage->setCommandOptionsString(json);
309 ASSERT_TRUE(msgManage->serialize(json));
310 printSuccess(
"Serialize SphinxInputJsonMessageManage");
315 std::stringstream str;
319 std::cout <<
"ret: '" << ret <<
"'\n";
324 ASSERT_TRUE(!outputJsonMessage.
isError());
325 ASSERT_TRUE(outputJsonMessage.
getData().empty());
327 printSuccess(
"Test command INDEX_START");
336 printSuccess(
"Serialize IndexStop");
339 msgManage->setCommandString(
"INDEX_STOP");
340 msgManage->setCommandOptionsString(json);
341 ASSERT_TRUE(msgManage->serialize(json));
342 printSuccess(
"Serialize SphinxInputJsonMessageManage");
347 std::stringstream str;
351 std::cout <<
"ret: '" << ret <<
"'\n";
356 ASSERT_TRUE(!outputJsonMessage.
isError());
357 ASSERT_TRUE(outputJsonMessage.
getData().empty());
359 printSuccess(
"Test command INDEX_STOP");
368 for (
size_t i=0;i<branches.size();++i)
372 printSuccess(
"Serialize IndexMerge");
375 msgManage->setCommandString(
"INDEX_MERGE");
376 msgManage->setCommandOptionsString(json);
377 ASSERT_TRUE(msgManage->serialize(json));
378 printSuccess(
"Serialize SphinxInputJsonMessageManage");
383 std::stringstream str;
387 std::cout <<
"ret: '" << ret <<
"'\n";
390 ASSERT_TRUE(!outputJsonMessage.
isError());
391 if (!outputJsonMessage.
getData().empty())
392 std::cout <<
"getData: '" << outputJsonMessage.
getData() <<
"'\n";
393 ASSERT_TRUE(outputJsonMessage.
getData().empty());
395 printSuccess(
"Test command INDEX_MERGE");
404 for (
size_t i=0;i<branches.size();++i)
407 ASSERT_TRUE(indexMergeTrunk.
serialize(json));
408 printSuccess(
"Serialize IndexMergeTrunk");
411 msgManage->setCommandString(
"INDEX_MERGE_TRUNK");
412 msgManage->setCommandOptionsString(json);
413 ASSERT_TRUE(msgManage->serialize(json));
414 printSuccess(
"Serialize SphinxInputJsonMessageManage");
419 std::stringstream str;
423 std::cout <<
"ret: '" << ret <<
"'\n";
426 ASSERT_TRUE(!outputJsonMessage.
isError());
427 if (!outputJsonMessage.
getData().empty())
428 std::cout <<
"getData: '" << outputJsonMessage.
getData() <<
"'\n";
429 ASSERT_TRUE(outputJsonMessage.
getData().empty());
431 printSuccess(
"Test command INDEX_MERGE_TRUNK");
440 for (
size_t i=0;i<branches.size();++i)
441 indexDeleteDataFile.
addBranch(branches[i]);
443 ASSERT_TRUE(indexDeleteDataFile.
serialize(json));
444 printSuccess(
"Serialize IndexDeleteDataFile");
447 msgManage->setCommandString(
"INDEX_DELETE_DATA_FILE");
448 msgManage->setCommandOptionsString(json);
449 ASSERT_TRUE(msgManage->serialize(json));
450 printSuccess(
"Serialize SphinxInputJsonMessageManage");
455 std::stringstream str;
459 std::cout <<
"ret: '" << ret <<
"'\n";
464 ASSERT_TRUE(!outputJsonMessage.
isError());
465 ASSERT_TRUE(outputJsonMessage.
getData().empty());
467 printSuccess(
"Test command INDEX_DELETE_DATA_FILE");
476 ASSERT_TRUE(indexDeleteSchemaFile.
serialize(json));
477 printSuccess(
"Serialize IndexDeleteSchemaFile");
480 msgManage->setCommandString(
"INDEX_DELETE_SCHEMA_FILE");
481 msgManage->setCommandOptionsString(json);
482 ASSERT_TRUE(msgManage->serialize(json));
483 printSuccess(
"Serialize SphinxInputJsonMessageManage");
488 std::stringstream str;
492 std::cout <<
"ret: '" << ret <<
"'\n";
497 ASSERT_TRUE(!outputJsonMessage.
isError());
498 ASSERT_TRUE(outputJsonMessage.
getData().empty());
500 printSuccess(
"Test command INDEX_DELETE_SCHEMA_FILE");
507 dataContent <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<sphinx:docset xmlns:sphinx=\"http://sphinxsearch.com\">\n<sphinx:document id=\"123456\">\n"
508 <<
"<title><![CDATA[[$ fObj --merge main delta --merge-dst-range deleted 0 0]]></title>\n"
509 <<
"<h><![CDATA[[Any documents marked as deleted (value 1) would be removed from the newly-merged destination index. It can be added several times to the command line, to add successive filters to the merge, all of which must be met in order for a document to become part of the final index.]]></h>\n"
510 <<
"</sphinx:document>\n<sphinx:document id=\"444\">\n"
511 <<
"<title><![CDATA[[$ fObj --merge main delta ]]></title>\n"
512 <<
"<h><![CDATA[[It can be added several times to the command line.]]></h>\n"
513 <<
"</sphinx:document>\n</sphinx:docset>";
519 ASSERT_TRUE(indexAppendDataFile.
serialize(json));
520 printSuccess(
"Serialize IndexAppendDataFile");
523 msgManage->setCommandString(
"INDEX_APPEND_DATA_FILE");
524 msgManage->setCommandOptionsString(json);
525 ASSERT_TRUE(msgManage->serialize(json));
526 printSuccess(
"Serialize SphinxInputJsonMessageManage");
531 std::stringstream str;
535 std::cout <<
"ret: '" << ret <<
"'\n";
541 std::ifstream ifs(file.c_str());
542 ASSERT_TRUE(ifs.is_open());
544 bool isFound =
false;
546 while(getline(ifs, line))
548 if (line.find(
"444")!=std::string::npos)
555 ASSERT_TRUE(isFound==
true);
558 ASSERT_TRUE(!outputJsonMessage.
isError());
560 printSuccess(
"Test command INDEX_APPEND_DATA_FILE");
569 for (
size_t i=0;i<ids.size();++i)
570 indexDeleteDoc.
addId(ids[i]);
572 ASSERT_TRUE(indexDeleteDoc.
serialize(json));
573 printSuccess(
"Serialize IndexDeleteDoc");
576 msgManage->setCommandString(
"INDEX_DELETE_DOC");
577 msgManage->setCommandOptionsString(json);
578 ASSERT_TRUE(msgManage->serialize(json));
579 printSuccess(
"Serialize SphinxInputJsonMessageManage");
584 std::stringstream str;
588 std::cout <<
"ret: '" << ret <<
"'\n";
593 std::ifstream ifs(file.c_str());
594 ASSERT_TRUE(ifs.is_open());
597 std::set<unsigned long long> readIds;
599 while(getline(ifs, line))
603 readIds.insert(std::stoull(line));
607 std::cout <<
"std::stoull(" << line <<
") - BAD param." <<
std::endl;
612 for (
size_t i=0;i<ids.size();++i)
613 ASSERT_TRUE(readIds.find(ids[i])!=readIds.end());
616 ASSERT_TRUE(!outputJsonMessage.
isError());
617 ASSERT_TRUE(outputJsonMessage.
getData().empty());
619 printSuccess(
"Test command INDEX_DELETE_DOC");
628 ASSERT_TRUE(indexDeleteDocNumber.
serialize(json));
629 printSuccess(
"Serialize IndexDeleteDocNumber");
632 msgManage->setCommandString(
"INDEX_DELETE_DOC_NUMBER");
633 msgManage->setCommandOptionsString(json);
634 ASSERT_TRUE(msgManage->serialize(json));
635 printSuccess(
"Serialize SphinxInputJsonMessageManage");
640 std::stringstream str;
644 std::cout <<
"ret: '" << ret <<
"'\n";
649 ASSERT_TRUE(!outputJsonMessage.
isError());
650 ASSERT_TRUE(!outputJsonMessage.
getData().empty());
651 std::cout <<
"deleted list count = " << outputJsonMessage.
getData() <<
std::endl;
654 printSuccess(
"Test command INDEX_DELETE_DOC_NUMBER");
663 for (
size_t i=0;i<branches.size();++i)
666 ASSERT_TRUE(indexPackDocData.
serialize(json));
667 printSuccess(
"Serialize IndexPackDocData");
670 msgManage->setCommandString(
"INDEX_PACK_DOC_DATA");
671 msgManage->setCommandOptionsString(json);
672 ASSERT_TRUE(msgManage->serialize(json));
673 printSuccess(
"Serialize SphinxInputJsonMessageManage");
678 std::stringstream str;
682 std::cout <<
"ret: '" << ret <<
"'\n";
687 ASSERT_TRUE(!outputJsonMessage.
isError());
688 ASSERT_TRUE(!outputJsonMessage.
getData().empty());
689 std::cout <<
"Document count = " << outputJsonMessage.
getData() <<
std::endl;
691 printSuccess(
"Test command INDEX_PACK_DOC_DATA");
702 ASSERT_TRUE(indexCreate.
serialize(json));
703 printSuccess(
"Serialize IndexRemove");
706 msgManage->setCommandString(
"INDEX_REMOVE");
707 msgManage->setCommandOptionsString(json);
708 ASSERT_TRUE(msgManage->serialize(json));
709 printSuccess(
"Serialize SphinxInputJsonMessageManage");
714 std::stringstream str;
718 std::cout <<
"ret: '" << ret <<
"'\n";
723 ASSERT_TRUE(!outputJsonMessage.
isError());
724 ASSERT_TRUE(outputJsonMessage.
getData().empty());
726 printSuccess(
"Test command INDEX_REMOVE");
737 printSuccess(
"Serialize IndexCopy");
740 msgManage->setCommandString(
"INDEX_COPY");
741 msgManage->setCommandOptionsString(json);
742 ASSERT_TRUE(msgManage->serialize(json));
743 printSuccess(
"Serialize SphinxInputJsonMessageManage");
748 std::stringstream str;
752 std::cout <<
"ret: '" << ret <<
"'\n";
757 ASSERT_TRUE(!outputJsonMessage.
isError());
758 ASSERT_TRUE(outputJsonMessage.
getData().empty());
760 printSuccess(
"Test command INDEX_COPY");
770 ASSERT_TRUE(indexRename.
serialize(json));
771 printSuccess(
"Serialize IndexRename");
774 msgManage->setCommandString(
"INDEX_RENAME");
775 msgManage->setCommandOptionsString(json);
776 ASSERT_TRUE(msgManage->serialize(json));
777 printSuccess(
"Serialize SphinxInputJsonMessageManage");
782 std::stringstream str;
786 std::cout <<
"ret: '" << ret <<
"'\n";
791 ASSERT_TRUE(!outputJsonMessage.
isError());
792 ASSERT_TRUE(outputJsonMessage.
getData().empty());
794 printSuccess(
"Test command INDEX_RENAME");
808 ASSERT_TRUE(indexSetConfigVar.
serialize(json));
809 printSuccess(
"Serialize IndexSetConfigVar");
812 msgManage->setCommandString(
"INDEX_SET_CONFIG_VAR");
813 msgManage->setCommandOptionsString(json);
814 ASSERT_TRUE(msgManage->serialize(json));
815 printSuccess(
"Serialize SphinxInputJsonMessageManage");
820 std::stringstream str;
824 std::cout <<
"ret: '" << ret <<
"'\n";
827 ASSERT_TRUE(!outputJsonMessage.
isError());
828 ASSERT_TRUE(outputJsonMessage.
getData().empty());
830 printSuccess(
"Test command INDEX_SET_CONFIG_VAR");
843 ASSERT_TRUE(indexGetConfigVar.
serialize(json));
844 printSuccess(
"Serialize IndexGetConfigVar");
847 msgManage->setCommandString(
"INDEX_GET_CONFIG_VAR");
848 msgManage->setCommandOptionsString(json);
849 ASSERT_TRUE(msgManage->serialize(json));
850 printSuccess(
"Serialize SphinxInputJsonMessageManage");
855 std::stringstream str;
859 std::cout <<
"ret: '" << ret <<
"'\n";
862 ASSERT_TRUE(!outputJsonMessage.
isError());
863 ASSERT_TRUE(!outputJsonMessage.
getData().empty());
864 std::cout <<
"Parameter value: '" << outputJsonMessage.
getData() <<
"'" <<
std::endl;
865 parameterValue = outputJsonMessage.
getData();
867 printSuccess(
"Test command INDEX_GET_CONFIG_VAR");
874 std::string
dataContent =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<sphinx:docset xmlns:sphinx=\"http://sphinxsearch.com\">\n<sphinx:schema>\n<sphinx:field name = \"title\" weight=\"2\"/>\n<sphinx:field name=\"h\" weight=\"5\"/>\n</sphinx:schema>\n</sphinx:docset>";
879 ASSERT_TRUE(indexCheckSchema.
serialize(json));
880 printSuccess(
"Serialize IndexCheckSchema");
883 msgManage->setCommandString(
"INDEX_CHECK_SCHEMA");
884 msgManage->setCommandOptionsString(json);
885 ASSERT_TRUE(msgManage->serialize(json));
886 printSuccess(
"Serialize SphinxInputJsonMessageManage");
891 std::stringstream str;
895 std::cout <<
"ret: '" << ret <<
"'\n";
900 ASSERT_TRUE(!outputJsonMessage.
isError());
902 printSuccess(
"Test command INDEX_CHECK_SCHEMA");
911 ASSERT_TRUE(indexStatusSearchd.
serialize(json));
912 printSuccess(
"Serialize IndexStatusSearchd");
915 msgManage->setCommandString(
"INDEX_STATUS_SEARCHD");
916 msgManage->setCommandOptionsString(json);
917 ASSERT_TRUE(msgManage->serialize(json));
918 printSuccess(
"Serialize SphinxInputJsonMessageManage");
923 std::stringstream str;
927 std::cout <<
"ret: '" << ret <<
"'\n";
932 ASSERT_TRUE(!outputJsonMessage.
isError());
934 ASSERT_TRUE(!outputJsonMessage.
getData().empty());
936 printSuccess(
"Test command INDEX_STATUS_SEARCHD");
945 ASSERT_TRUE(indexStatus.
serialize(json));
946 printSuccess(
"Serialize IndexStatus");
949 msgManage->setCommandString(
"INDEX_STATUS");
950 msgManage->setCommandOptionsString(json);
951 ASSERT_TRUE(msgManage->serialize(json));
952 printSuccess(
"Serialize SphinxInputJsonMessageManage");
957 std::stringstream str;
961 std::cout <<
"ret: '" << ret <<
"'\n";
966 ASSERT_TRUE(!outputJsonMessage.
isError());
968 ASSERT_TRUE(!outputJsonMessage.
getData().empty());
970 printSuccess(
"Test command INDEX_STATUS");
982 printSuccess(
"Serialize IndexMaxDocId");
985 msgManage->setCommandString(
"INDEX_MAX_DOC_ID");
986 msgManage->setCommandOptionsString(json);
987 assert(msgManage->serialize(json));
988 printSuccess(
"Serialize SphinxInputJsonMessageManage");
993 std::stringstream str;
997 std::cout <<
"ret: '" << ret <<
"'\n";
1002 assert(!outputJsonMessage.
isError());
1004 assert(!outputJsonMessage.
getData().empty());
1006 printSuccess(
"Test command INDEX_MAX_DOC_ID");
1007 return std::stoull(outputJsonMessage.
getData());
1013 std::vector<std::string>
branches = {
"*"};
1019 dataContent <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<sphinx:docset xmlns:sphinx=\"http://sphinxsearch.com\">\n<sphinx:document id=\"123\">\n"
1020 <<
"<title><![CDATA[[- Information interchange - Representation of dates and times. A discussion of ISO 8601 has been written by Markus Kuhn. ISO 8601 describes a large number of date/time formats. For example it defines Basic Format, without punctuation, and Extended Format, with punctuation, and it allows elements to be omitted. This profile defines a restricted range of formats, all of which are valid ISO 8601 dates and times. The aim is to simplify the use of ISO 8601 in World Wide Web-related standards, and to avoid the need for the developers and users of these standards to obtain copies of ISO 8601 itself.]]></title>\n"
1021 <<
"<h><![CDATA[[time, so this profile defines six levels. Standards that reference this profile should specify one or more of these granularities. If a given standard allows more than one granularity, it should specify the meaning of the dates and times with reduced precision, for example, the result of comparing two dates with different precisions. The formats are as follows. Exactly the components shown here must be present, with exactly this punctuation. Note that the \"T\" appears literally in the string, to indicate the beginning of the time element, as specified in ISO 8601. Year: YYYY (eg 1997) Year and month: YYYY-MM (eg 1997-07)]]></h>\n"
1022 <<
"</sphinx:document>\n</sphinx:docset>";
1028 dataContent.str(
"");
1029 dataContent <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<sphinx:docset xmlns:sphinx=\"http://sphinxsearch.com\">\n<sphinx:document id=\"133\">\n"
1030 <<
"<title><![CDATA[[- Information interchange - ISO 8601 describes a large , and Extended Format, with punctuation, and it allows elements to be omitted. This profile defines a restricted range of formats, all of which are valid ISO 8601 dates and times. The aim is to simplify the use of ISO 8601 in World Wide Web-related standards, and to avoid the need for the developers and users of these standards to obtain copies of ISO 8601 itself.]]></title>\n"
1031 <<
"<h><![CDATA[[time, so this profile defines six levels. omparing two dates with different precisions. The formats are as follows. Exactly the components shown here must be present, with exactly this punctuation. Note that the \"T\" appears literally in the string, to indicate the beginning of the time element, as specified in ISO 8601. Year: YYYY (eg 1997) Year and month: YYYY-MM (eg 1997-07)]]></h>\n"
1032 <<
"</sphinx:document>\n"
1033 <<
"\n<sphinx:document id=\"53\">\n"
1034 <<
"<title><![CDATA[[ There are more differences between 'gcc' and 'g++' than only the standard libraries, so gcc -lstdc++ will still not get you the same behavior as g++. We put all of that language-specific behavior into its own driver .]]></title>\n"
1035 <<
"<h><![CDATA[[There are more differences between 'gcc' and 'g++' than only the standard libraries, so gcc -lstdc++ will still not get you the same behavior as g++. We put all of that language-specific behavior into its own driver ]]></h>\n"
1036 <<
"</sphinx:document>\n</sphinx:docset>";
1043 branches.push_back(
"b0002");
1049 branches.push_back(
"*");
1056 branches.push_back(
"b0001");
1069 ASSERT_TRUE(fourMaxDocID);
1070 ASSERT_TRUE(firstMaxDocID==threeMaxDocID);
1071 ASSERT_TRUE(secondMaxDocID==fiveMaxDocID);
1072 printSuccess(
"Extended test command INDEX_MAX_DOC_ID");
1081 ASSERT_TRUE(indexDataList.
serialize(json));
1082 printSuccess(
"Serialize IndexDataList");
1085 msgManage->setCommandString(
"INDEX_DATA_LIST");
1086 msgManage->setCommandOptionsString(json);
1087 ASSERT_TRUE(msgManage->serialize(json));
1088 printSuccess(
"Serialize SphinxInputJsonMessageManage");
1093 std::stringstream str;
1097 std::cout <<
"ret: '" << ret <<
"'\n";
1102 ASSERT_TRUE(!outputJsonMessage.
isError());
1104 ASSERT_TRUE(!outputJsonMessage.
getData().empty());
1106 printSuccess(
"Test command INDEX_DATA_LIST");
1115 ASSERT_TRUE(indexBranchesList.
serialize(json));
1116 printSuccess(
"Serialize IndexBranchesList");
1119 msgManage->setCommandString(
"INDEX_BRANCHES_LIST");
1120 msgManage->setCommandOptionsString(json);
1121 ASSERT_TRUE(msgManage->serialize(json));
1122 printSuccess(
"Serialize SphinxInputJsonMessageManage");
1127 std::stringstream str;
1131 std::cout <<
"ret: '" << ret <<
"'\n";
1136 ASSERT_TRUE(!outputJsonMessage.
isError());
1138 ASSERT_TRUE(!outputJsonMessage.
getData().empty());
1140 printSuccess(
"Test command INDEX_BRANCHES_LIST");
1149 for (
size_t i=0;i<branches.size();++i)
1150 indexBranchesInfo.
addBranch(branches[i]);
1151 ASSERT_TRUE(indexBranchesInfo.
serialize(json));
1152 printSuccess(
"Serialize IndexBranchesInfo");
1155 msgManage->setCommandString(
"INDEX_BRANCHES_INFO");
1156 msgManage->setCommandOptionsString(json);
1157 ASSERT_TRUE(msgManage->serialize(json));
1158 printSuccess(
"Serialize SphinxInputJsonMessageManage");
1163 std::stringstream str;
1167 std::cout <<
"ret: '" << ret <<
"'\n";
1172 ASSERT_TRUE(!outputJsonMessage.
isError());
1174 ASSERT_TRUE(!outputJsonMessage.
getData().empty());
1176 printSuccess(
"Test command INDEX_BRANCHES_INFO");
1185 for (
size_t i=0;i<branches.size();++i)
1186 indexBranchesStatus.
addBranch(branches[i]);
1187 ASSERT_TRUE(indexBranchesStatus.
serialize(json));
1188 printSuccess(
"Serialize IndexBranchesStatus");
1191 msgManage->setCommandString(
"INDEX_BRANCHES_STATUS");
1192 msgManage->setCommandOptionsString(json);
1193 ASSERT_TRUE(msgManage->serialize(json));
1194 printSuccess(
"Serialize SphinxInputJsonMessageManage");
1199 std::stringstream str;
1203 std::cout <<
"ret: '" << ret <<
"'\n";
1208 ASSERT_TRUE(!outputJsonMessage.
isError());
1210 ASSERT_TRUE(!outputJsonMessage.
getData().empty());
1212 printSuccess(
"Test command INDEX_BRANCHES_STATUS");
1218 const unsigned int SZ = 3;
1219 Poco::SharedPtr<HCE::sphinx::SphinxFunctionalObject>
pObj[SZ];
1220 for (
unsigned int i=0;i<SZ;++i)
1228 ASSERT_TRUE(indexConnect.
serialize(json));
1229 printSuccess(
"Serialize IndexConnect");
1232 msgManage->setCommandString(
"INDEX_CONNECT");
1233 msgManage->setCommandOptionsString(json);
1234 ASSERT_TRUE(msgManage->serialize(json));
1235 printSuccess(
"Serialize SphinxInputJsonMessageManage");
1240 std::stringstream str;
1243 std::string
ret = pObj[i]->Process(str.str());
1244 std::cout <<
"ret: '" << ret <<
"'" <<
std::endl;
1249 ASSERT_TRUE(!outputJsonMessage.
isError());
1250 ASSERT_TRUE(outputJsonMessage.
getData().empty());
1253 printSuccess(
"Test command INDEX_CONNECT");
1261 ASSERT_TRUE(indexDisconnect.
serialize(json));
1262 printSuccess(
"Serialize IndexDisconnect");
1265 msgManage->setCommandString(
"INDEX_DISCONNECT");
1266 msgManage->setCommandOptionsString(json);
1267 ASSERT_TRUE(msgManage->serialize(json));
1268 printSuccess(
"Serialize SphinxInputJsonMessageManage");
1273 std::stringstream str;
1277 std::cout <<
"ret: '" << ret <<
"'" <<
std::endl;
1282 ASSERT_TRUE(!outputJsonMessage.
isError());
1283 ASSERT_TRUE(outputJsonMessage.
getData().empty());
1285 printSuccess(
"Test command INDEX_DISCONNECT");