Merge branch 'master' of rjawor.vm.wmi.amu.edu.pl:concordia-server
This commit is contained in:
commit
a2b6853dcf
@ -59,3 +59,19 @@ void JsonGenerator::writeSimpleSearchResult(rapidjson::Writer<rapidjson::StringB
|
|||||||
|
|
||||||
jsonWriter.EndObject(); //simple search result
|
jsonWriter.EndObject(); //simple search result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JsonGenerator::writeLexiconSearchResult(rapidjson::Writer<rapidjson::StringBuffer> & 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
|
||||||
|
}
|
||||||
|
@ -22,6 +22,10 @@ public:
|
|||||||
static void writeSimpleSearchResult(rapidjson::Writer<rapidjson::StringBuffer> & jsonWriter,
|
static void writeSimpleSearchResult(rapidjson::Writer<rapidjson::StringBuffer> & jsonWriter,
|
||||||
const SimpleSearchResult & result);
|
const SimpleSearchResult & result);
|
||||||
|
|
||||||
|
static void writeLexiconSearchResult(rapidjson::Writer<rapidjson::StringBuffer> & jsonWriter,
|
||||||
|
const SimpleSearchResult & result);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -52,7 +52,7 @@ void SearcherController::lexiconSearch(rapidjson::Writer<rapidjson::StringBuffer
|
|||||||
jsonWriter.String("status");
|
jsonWriter.String("status");
|
||||||
jsonWriter.String("success");
|
jsonWriter.String("success");
|
||||||
jsonWriter.String("result");
|
jsonWriter.String("result");
|
||||||
JsonGenerator::writeSimpleSearchResult(jsonWriter, result);
|
JsonGenerator::writeLexiconSearchResult(jsonWriter, result);
|
||||||
jsonWriter.EndObject();
|
jsonWriter.EndObject();
|
||||||
} else {
|
} else {
|
||||||
JsonGenerator::signalError(jsonWriter, "no such tm!");
|
JsonGenerator::signalError(jsonWriter, "no such tm!");
|
||||||
|
Loading…
Reference in New Issue
Block a user