diff --git a/concordia-server/unit_dao.cpp b/concordia-server/unit_dao.cpp index 7a86ecb..b8343a2 100644 --- a/concordia-server/unit_dao.cpp +++ b/concordia-server/unit_dao.cpp @@ -167,11 +167,19 @@ SimpleSearchResult UnitDAO::_getResultFromFragment( } ExampleOccurrence UnitDAO::_getExampleOccurrence(DBconnection & connection, const SubstringOccurrence sOccurrence, const int matchedLength) { + Logger::log("_getExampleOccurrence"); std::string query = "SELECT unit.id, unit.source_segment, unit.target_segment, unit.source_tokens[$1::integer], unit.source_tokens[$2::integer], unit.target_tokens, unit.alignments, source.name, source.link FROM unit left join source on unit.source_id = source.external_id where unit.id = $3::integer;"; std::vector params; - params.push_back(new IntParam(2*sOccurrence.getOffset()+1)); - params.push_back(new IntParam(2*(sOccurrence.getOffset()+matchedLength))); - params.push_back(new IntParam(sOccurrence.getId())); + int sourceTokenStart = 2*sOccurrence.getOffset()+1; + int sourceTokenEnd = 2*(sOccurrence.getOffset()+matchedLength); + int sourceId = sOccurrence.getId(); + Logger::logInt("sourceTokenStart", sourceTokenStart); + Logger::logInt("sourceTokenEnd", sourceTokenEnd); + Logger::logInt("sourceId", sourceId); + + params.push_back(new IntParam(sourceTokenStart)); + params.push_back(new IntParam(sourceTokenEnd); + params.push_back(new IntParam(sourceId)); PGresult * result = connection.execute(query, params); ExampleOccurrence occurrence(connection.getIntValue(result,0,0), // example id connection.getIntValue(result,0,3), // matched example start