Commit aa06a6a2 authored by tobinski's avatar tobinski
Browse files

Add language to the kafka query

parent 3a6975d0
......@@ -85,11 +85,13 @@ 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
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'];
......@@ -103,6 +105,7 @@ 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,
......@@ -110,6 +113,7 @@ 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'];
......
......@@ -20,6 +20,7 @@ export class Validator {
check('trust', 'The level of trust for a given provider (Not yet implemented)').optional().isArray(),
check('depth', 'Depth to traverse the graph. It defines how many hops the query take to fetch connected nodes').optional().isNumeric(),
check('timeout', 'A timeout in ms to wait for the streaming app to send data').optional().isNumeric(),
check('language', 'The language of the provider name').optional().isString(),
Validator.extract,
];
}
......@@ -33,6 +34,7 @@ export class Validator {
check('distance', 'The radius to search in for a given resource in meter f.e. 5000. Default: 10000').optional().isNumeric(),
check('fuzziness', 'The fuzziness to apply to the name of a resource. This will use levenshtein distance. Default: 2').optional().isNumeric(),
check('timeout', 'A timeout in ms to wait for the streaming app to send data').optional().isNumeric(),
check('language', 'The language of the provider name').optional().isString(),
Validator.extract,
];
}
......
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