From 91cdbb80450680e86d4316692cf6d49daa4c1ee5 Mon Sep 17 00:00:00 2001 From: Jake Collins Date: Tue, 11 Jul 2023 15:24:15 -0500 Subject: [PATCH] Allow NAME sort for default + passed in sortField --- packages/marko-web-search/config/index.js | 2 +- packages/marko-web-search/config/query-params.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/marko-web-search/config/index.js b/packages/marko-web-search/config/index.js index 8fe96b229..4e9a92325 100644 --- a/packages/marko-web-search/config/index.js +++ b/packages/marko-web-search/config/index.js @@ -50,7 +50,7 @@ class MarkoWebSearchConfig { Joi.number().integer().min(1).required(), ).default([]), - defaultSortField: Joi.string().allow('PUBLISHED', 'SCORE').default('PUBLISHED'), + defaultSortField: Joi.string().allow('NAME', 'PUBLISHED', 'SCORE').default('PUBLISHED'), }).default(), params); this.contentTypeObjects = contentTypes.sort().map((type) => (type.label ? ({ diff --git a/packages/marko-web-search/config/query-params.js b/packages/marko-web-search/config/query-params.js index ffa0a7abb..25c58aae9 100644 --- a/packages/marko-web-search/config/query-params.js +++ b/packages/marko-web-search/config/query-params.js @@ -19,7 +19,7 @@ const fromArrayInput = (arr) => { const toIntArrayInput = (arr) => toArrayInput(arr, (v) => parseInt(v, 10)); const toStringArrayInput = (arr) => toArrayInput(arr, (v) => v.trim()); -const sortFieldSet = new Set(['PUBLISHED', 'SCORE']); +const sortFieldSet = new Set(['NAME', 'PUBLISHED', 'SCORE']); const sortOrderSet = new Set(['DESC', 'ASC']); class MarkoWebSearchQueryParamConfig {