From cb24f2b26b7abfd7bccf8885c6c7c3ad5844ae2e Mon Sep 17 00:00:00 2001 From: Andy Wallace Date: Wed, 9 Aug 2023 16:22:57 -0400 Subject: [PATCH] fix: event listing w/ keyword date sort and filter --- pages/visit/events-exhibitions/index.vue | 3 ++- plugins/data-api.js | 4 +++- utils/searchConfig.js | 12 +++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pages/visit/events-exhibitions/index.vue b/pages/visit/events-exhibitions/index.vue index aa482b70c..0068c26f5 100644 --- a/pages/visit/events-exhibitions/index.vue +++ b/pages/visit/events-exhibitions/index.vue @@ -244,7 +244,8 @@ export default { config.eventsExhibitionsList.sortField, config.eventsExhibitionsList.orderBy, config.eventsExhibitionsList.resultFields, - config.eventsExhibitionsList.filters + config.eventsExhibitionsList.filters, + config.eventsExhibitionsList.extraFilters, ) //console.log("getsearchdata method:" + JSON.stringify(results)) // this.events = [] diff --git a/plugins/data-api.js b/plugins/data-api.js index c7c6614a8..b33eace17 100644 --- a/plugins/data-api.js +++ b/plugins/data-api.js @@ -135,7 +135,8 @@ export default function ({ $config }, inject) { sort, orderBy, source = ["*"], - aggFields = [] + aggFields = [], + extraFilters = [], ) { //var data_url = new URL(`${ES_URL}/apps-dev-library-website/_search`) console.log("In data api keywordsearchwithfilters") @@ -201,6 +202,7 @@ export default function ({ $config }, inject) { }, ...parseSectionHandle(sectionHandle), ...parseFilterQuery(filters), + ...extraFilters, ], }, }, diff --git a/utils/searchConfig.js b/utils/searchConfig.js index ecf4a854d..0b8e6fbb6 100644 --- a/utils/searchConfig.js +++ b/utils/searchConfig.js @@ -265,8 +265,18 @@ const config = { inputType: "date", } */ ], + extraFilters: [ + // no manual control + { + "range": { + "endDateWithTime": { + "gte": "now", + }, + }, + }, + ], resultFields: ["*"], - sortField: "title.keyword", + sortField: "startDateWithTime", orderBy: "asc", }, }