Merge pull request from lbryio/search_updates

updated search query for elasticsearch. value is stored as a nested o…
This commit is contained in:
filipnyquist 2018-03-09 16:47:27 +01:00 committed by GitHub
commit 04ef25cbc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,6 +26,45 @@ function getResults (input) {
index : 'claims',
_source: ['name', 'value', 'claimId'],
body : {
'query': {
'bool': {
'should': [
{
'match': {
'name^100': '*' + input.s.trim() + '*',
},
},
{
'nested': { // Need nested query because value is a nested object on the elastic document
'path' : 'value',
'query': {
'bool': {
'should': [
{
'match': {
'value.stream.metadata.title': '*' + input.s.trim() + '*',
},
},
{
'match': {
'value.stream.metadata.author': '*' + input.s.trim() + '*',
},
},
{
'match': {
'value.stream.metadata.description': '*' + input.s.trim() + '*',
},
},
],
},
},
},
},
],
},
},
},
/* body : {
'query': {
'bool': {
'must': {
@ -43,7 +82,7 @@ function getResults (input) {
},
size: input.size,
from: input.from,
},
}, */
});
}