Don't make 'Accepted' bid state claims searchable ( mempool ). #130
1 changed files with 15 additions and 10 deletions
|
@ -168,7 +168,7 @@ function getResults (input) {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// End of search parts
|
// End of search parts
|
||||||
return eclient.search({
|
let esQuery = {
|
||||||
index : 'claims',
|
index : 'claims',
|
||||||
_source: ['name', 'value', 'claimId'],
|
_source: ['name', 'value', 'claimId'],
|
||||||
body : {
|
body : {
|
||||||
|
@ -200,7 +200,9 @@ function getResults (input) {
|
||||||
_score: 'desc',
|
_score: 'desc',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
|
// console.log('QUERY: ', esQuery);
|
||||||
|
return eclient.search(esQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIndex () {
|
function getIndex () {
|
||||||
|
@ -256,12 +258,14 @@ function getFilters (input) {
|
||||||
// this is the best place for putting things like filtering on the type of content
|
// 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
|
// Perhaps we can add search param that will filter on how people have categorized / tagged their content
|
||||||
var filters = [];
|
var filters = [];
|
||||||
|
var bidStateFilter = {'bool': {'must_not': {'match': { 'bid_state': 'Accepted' }}}};
|
||||||
if (input.nsfw === 'true' || input.nsfw === 'false') {
|
if (input.nsfw === 'true' || input.nsfw === 'false') {
|
||||||
const nsfwFilter = {'match': {'value.stream.metadata.nsfw': input.nsfw}};
|
const nsfwFilter = {'match': {'value.stream.metadata.nsfw': input.nsfw}};
|
||||||
filters.push(nsfwFilter);
|
filters.push(nsfwFilter);
|
||||||
}
|
}
|
||||||
if (filters.length > 0) {
|
if (filters.length > 0) {
|
||||||
const filterQuery = {
|
const filterQuery = [
|
||||||
|
{
|
||||||
'nested': {
|
'nested': {
|
||||||
'path' : 'value',
|
'path' : 'value',
|
||||||
'query': {
|
'query': {
|
||||||
|
@ -270,10 +274,11 @@ function getFilters (input) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
bidStateFilter];
|
||||||
return filterQuery;
|
return filterQuery;
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [bidStateFilter];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue