@searchkit/api
Advanced tools
Comparing version 4.0.0-next.6 to 4.0.0-next.7
@@ -315,4 +315,4 @@ "use strict"; | ||
}; | ||
function RelevanceQueryMatch(query, search_attributes, queryRuleActions) { | ||
if (queryRuleActions) { | ||
function queryRulesWrapper(organicQuery, queryRuleActions) { | ||
if (queryRuleActions.touched) { | ||
return { | ||
@@ -323,8 +323,3 @@ function_score: { | ||
ids: queryRuleActions.pinnedDocs, | ||
organic: { | ||
combined_fields: { | ||
query: queryRuleActions.query, | ||
fields: search_attributes | ||
} | ||
} | ||
organic: organicQuery | ||
} | ||
@@ -336,2 +331,5 @@ }, | ||
} | ||
return organicQuery; | ||
} | ||
function RelevanceQueryMatch(query, search_attributes) { | ||
return { | ||
@@ -351,6 +349,7 @@ combined_fields: { query, fields: search_attributes } | ||
]; | ||
const organicQuery = typeof query === "string" && query !== "" ? (requestOptions == null ? void 0 : requestOptions.getQuery) ? requestOptions.getQuery(query, searchAttributes, config) : RelevanceQueryMatch(query, searchAttributes) : []; | ||
return { | ||
bool: { | ||
filter: filters, | ||
must: typeof query === "string" && query !== "" ? (requestOptions == null ? void 0 : requestOptions.getQuery) ? requestOptions.getQuery(query, searchAttributes, config) : RelevanceQueryMatch(query, searchAttributes, queryRuleActions) : [] | ||
must: queryRuleActions.touched ? queryRulesWrapper(organicQuery, queryRuleActions) : organicQuery | ||
} | ||
@@ -685,2 +684,3 @@ }; | ||
rule.actions.map((action) => { | ||
sum.touched = true; | ||
if (action.action === "PinnedResult") { | ||
@@ -710,3 +710,4 @@ sum.pinnedDocs.push(...action.documentIds); | ||
userData: [], | ||
facetAttributesOrder: void 0 | ||
facetAttributesOrder: void 0, | ||
touched: false | ||
} | ||
@@ -713,0 +714,0 @@ ); |
{ | ||
"name": "@searchkit/api", | ||
"version": "4.0.0-next.6", | ||
"version": "4.0.0-next.7", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "description": "", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
148809
1687