Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
histhub
api
Commits
aa06a6a2
Commit
aa06a6a2
authored
Sep 27, 2019
by
tobinski
Browse files
Add language to the kafka query
parent
3a6975d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/controller/api.ts
View file @
aa06a6a2
...
...
@@ -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
'
];
...
...
src/middleware/validator.ts
View file @
aa06a6a2
...
...
@@ -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
,
];
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment