Commit 1db3ef32 authored by tobinski's avatar tobinski
Browse files

Use language query

parent cecd3b65
Pipeline #3445 passed with stage
in 2 minutes and 50 seconds
......@@ -85,13 +85,11 @@ export class ApiController {
* @param next
*/
public static concordance(req: InterfaceRequestKafka, res: Response, next: NextFunction) {
const language = req.validatedBody.language || 'de';
const message: any = { };
message.resolverneo4j = {
depth: parseInt(req.validatedBody.depth) || 1,
};
message.verb = 'same_as';
message.language = language;
// add values for next middleware
req.message = ApiController.buildMessage(req, message);
req.config = ['resolverneo4j'];
......@@ -105,7 +103,6 @@ export class ApiController {
* @param next
*/
public static match(req: InterfaceRequestKafka, res: Response, next: NextFunction) {
const language = req.validatedBody.language || 'de';
const message: any = {};
message.resolverelasticsearch = {
distance: parseInt(req.validatedBody.distance) || 10000,
......@@ -113,7 +110,6 @@ export class ApiController {
};
// todo: change wording
message.verb = 'same_as';
message.language = language;
// add values for next middleware
req.message = ApiController.buildMessage(req, message);
req.config = ['resolverelasticsearch'];
......@@ -211,6 +207,7 @@ export class ApiController {
* On data, write stuff to kafka
*/
try {
console.log(message);
req.kafkaProducer.produce('request-geoconcordance', -1, message, id);
core.getReporter().setDataOut(1);
} catch (error) {
......@@ -229,6 +226,7 @@ export class ApiController {
// the message needs to be compatible to the schema
const url = req.url || req.originalUrl;
const id = shajs('sha256').update(url).digest('hex');
const language = req.validatedBody.language || 'de';
// get the verb from the params or the options
const verb: string = req.params.verb || options.verb;
......@@ -241,6 +239,7 @@ export class ApiController {
id,
verb,
node,
language,
config: options,
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment