Merge pull request #17 from wallermadev/master

Ready for app integration.
This commit is contained in:
Fillerino 2017-09-20 22:17:34 +02:00 committed by GitHub
commit 46278b3807
3 changed files with 35 additions and 34 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,2 +1,2 @@
export const port = process.env.PORT || 3000; export const port = process.env.PORT || 80;
export const baseApi = 'api'; export const baseApi = 'api';

View file

@ -20,22 +20,23 @@ function getResults (input) {
if (input.size === undefined) input.size = 10; if (input.size === undefined) input.size = 10;
if (input.from === undefined) input.from = 0; if (input.from === undefined) input.from = 0;
return eclient.search({ return eclient.search({
index: 'claims', index: "claims",
body : { _source: ["name", "value", "claimId"],
'query': { body: {
'bool': { "query": {
'must': { "bool": {
'query_string': { "must": {
'query' : input.s.trim(), "query_string": {
'fields': [ "query": '*' + input.s.trim() + '*',
'name', "fields": [
'value.stream.metadata.author', "name",
'value.stream.metadata.title', "value.stream.metadata.author",
'value.stream.metadata.description', "value.stream.metadata.title",
], "value.stream.metadata.description"
}, ]
}, }
}, }
}
}, },
size: input.size, size: input.size,
from: input.from, from: input.from,
@ -47,22 +48,22 @@ function getAutoComplete (input) {
if (input.size === undefined) input.size = 10; if (input.size === undefined) input.size = 10;
if (input.from === undefined) input.from = 0; if (input.from === undefined) input.from = 0;
return eclient.search({ return eclient.search({
index : 'claims', index: "claims",
_source: ['name', 'value.stream.metadata.title', 'value.stream.metadata.author'], _source: ["name", "value.stream.metadata.title", "value.stream.metadata.author"],
body : { body: {
'query': { "query": {
'bool': { "bool": {
'must': { "must": {
'query_string': { "query_string": {
'query' : input.s.trim(), "query": "*" + input.s.trim() + "*",
'fields': [ "fields": [
'name', "name",
'value.stream.metadata.title', "value.stream.metadata.title",
'value.stream.metadata.author', "value.stream.metadata.author"
], ]
}, }
}, }
}, }
}, },
size: input.size, size: input.size,
from: input.from, from: input.from,