Merge pull request #130 from lbryio/ignore_accepted_bid_state

Don't make 'Accepted' bid state  claims searchable ( mempool ).
This commit is contained in:
Mark 2018-11-05 21:00:51 -05:00 committed by GitHub
commit 15e020ee2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,7 +168,7 @@ function getResults (input) {
},
};
// End of search parts
return eclient.search({
let esQuery = {
index : 'claims',
_source: ['name', 'value', 'claimId'],
body : {
@ -200,7 +200,9 @@ function getResults (input) {
_score: 'desc',
},
},
});
};
// console.log('QUERY: ', esQuery);
return eclient.search(esQuery);
}
function getIndex () {
@ -256,12 +258,14 @@ function getFilters (input) {
// this is the best place for putting things like filtering on the type of content
// Perhaps we can add search param that will filter on how people have categorized / tagged their content
var filters = [];
var bidStateFilter = {'bool': {'must_not': {'match': { 'bid_state': 'Accepted' }}}};
if (input.nsfw === 'true' || input.nsfw === 'false') {
const nsfwFilter = {'match': {'value.stream.metadata.nsfw': input.nsfw}};
filters.push(nsfwFilter);
}
if (filters.length > 0) {
const filterQuery = {
const filterQuery = [
{
'nested': {
'path' : 'value',
'query': {
@ -270,10 +274,11 @@ function getFilters (input) {
},
},
},
};
},
bidStateFilter];
return filterQuery;
} else {
return [];
return [bidStateFilter];
}
}