From 7aa12e374dc6a4e7dd9ae92505c5805e23f3bc40 Mon Sep 17 00:00:00 2001 From: John Watkins Date: Tue, 26 Jul 2022 17:07:52 -0500 Subject: [PATCH] Add epAutosuggestQueryFilter to allow filtering ES query based on input element --- assets/js/autosuggest.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/assets/js/autosuggest.js b/assets/js/autosuggest.js index 9eeb180b16..f407566f85 100644 --- a/assets/js/autosuggest.js +++ b/assets/js/autosuggest.js @@ -562,6 +562,13 @@ function init() { query = JSON.stringify(query); } + // Allow filtering the search query based on the input. + if (typeof window.epAutosuggestQueryFilter !== 'undefined') { + query = JSON.stringify( + window.epAutosuggestQueryFilter(JSON.parse(query), searchText, input), + ); + } + // fetch the results const response = await esSearch(query, searchText);