diff --git a/concordia-server/json_generator.cpp b/concordia-server/json_generator.cpp index 475756c..7091704 100644 --- a/concordia-server/json_generator.cpp +++ b/concordia-server/json_generator.cpp @@ -59,3 +59,19 @@ void JsonGenerator::writeSimpleSearchResult(rapidjson::Writer & jsonWriter, + const SimpleSearchResult & result) { + jsonWriter.StartArray(); + + BOOST_FOREACH(ExampleOccurence occurence, result.getOccurences()) { + jsonWriter.StartObject(); + jsonWriter.String("sourceSegment"); + jsonWriter.String(occurence.getSourceSegment().c_str()); + jsonWriter.String("targetSegment"); + jsonWriter.String(occurence.getTargetSegment().c_str()); + jsonWriter.EndObject(); // occurence + } + + jsonWriter.EndArray(); //simple search result +} diff --git a/concordia-server/json_generator.hpp b/concordia-server/json_generator.hpp index 9fd7319..4f91481 100644 --- a/concordia-server/json_generator.hpp +++ b/concordia-server/json_generator.hpp @@ -22,6 +22,10 @@ public: static void writeSimpleSearchResult(rapidjson::Writer & jsonWriter, const SimpleSearchResult & result); + static void writeLexiconSearchResult(rapidjson::Writer & jsonWriter, + const SimpleSearchResult & result); + + private: }; diff --git a/concordia-server/searcher_controller.cpp b/concordia-server/searcher_controller.cpp index 99268da..13dace8 100644 --- a/concordia-server/searcher_controller.cpp +++ b/concordia-server/searcher_controller.cpp @@ -52,7 +52,7 @@ void SearcherController::lexiconSearch(rapidjson::Writer