Adding channel_id search back in. Reworked to avoid null queries being passed in.
Signed-off-by: Mark Beamer Jr <markbeamerjr@gmail.com>
This commit is contained in:
parent
e9598d6b76
commit
715ecc3d92
1 changed files with 30 additions and 26 deletions
|
@ -40,10 +40,11 @@ function getResults (input) {
|
|||
let escapedQuery = getEscapedQuery(trimmedQuery);
|
||||
let washedQuery = getEscapedQuery(getWashedQuery(trimmedQuery));
|
||||
let effectiveFactor = '0.00000000001';
|
||||
const dynamicFilters = () => {
|
||||
let queries = [];
|
||||
// Search is split up into different parts, all search parts goes under this line.
|
||||
let channelidSearch;
|
||||
if (input.channel_id !== undefined) {
|
||||
channelidSearch = { // If we got a channel_id argument, lets filter out only that channel_id
|
||||
const channelidSearch = { // If we got a channel_id argument, lets filter out only that channel_id
|
||||
'bool': {
|
||||
'must': {
|
||||
'query_string': {
|
||||
|
@ -53,10 +54,10 @@ function getResults (input) {
|
|||
},
|
||||
},
|
||||
};
|
||||
queries.push(channelidSearch);
|
||||
}
|
||||
let channelSearch;
|
||||
if (input.channel !== undefined) { // If we got a channel argument, lets filter out only that channel
|
||||
channelSearch = {
|
||||
const channelSearch = {
|
||||
'bool': {
|
||||
'must': {
|
||||
'query_string': {
|
||||
|
@ -66,7 +67,11 @@ function getResults (input) {
|
|||
},
|
||||
},
|
||||
};
|
||||
queries.push(channelSearch);
|
||||
}
|
||||
return queries;
|
||||
};
|
||||
|
||||
const conBoost = { // Controlling claims should get higher placement in search results.
|
||||
'match': {
|
||||
'bid_state': {
|
||||
|
@ -268,8 +273,7 @@ function getResults (input) {
|
|||
funcScoreChannelWeight,
|
||||
],
|
||||
'must': [
|
||||
channelSearch,
|
||||
// channelidSearch, // Commented for now to prevent query error while I investigate.
|
||||
...dynamicFilters(),
|
||||
{
|
||||
'bool': {
|
||||
'should': [
|
||||
|
@ -292,7 +296,7 @@ function getResults (input) {
|
|||
},
|
||||
},
|
||||
};
|
||||
// console.log('QUERY: ', esQuery);
|
||||
// console.log('QUERY: ', JSON.stringify(esQuery));
|
||||
return eclient.search(esQuery);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue