diff --git a/news/4658.feature b/news/4658.feature new file mode 100644 index 0000000000..0c4c3cc11b --- /dev/null +++ b/news/4658.feature @@ -0,0 +1 @@ +Added querystring search get option. @robgietema \ No newline at end of file diff --git a/src/actions/querystringsearch/querystringsearch.js b/src/actions/querystringsearch/querystringsearch.js index 9dff75b72d..6b178436f7 100644 --- a/src/actions/querystringsearch/querystringsearch.js +++ b/src/actions/querystringsearch/querystringsearch.js @@ -31,24 +31,30 @@ export function getQueryStringResults(path, data, subrequest, page) { } } + const query = { + ...requestData, + ...(!requestData.b_size && { + b_size: settings.defaultPageSize, + }), + ...(page && { + b_start: requestData.b_size + ? data.b_size * (page - 1) + : settings.defaultPageSize * (page - 1), + }), + query: requestData?.query, + }; + return { type: GET_QUERYSTRING_RESULTS, subrequest, request: { - op: 'post', - path: `${path}/@querystring-search`, - data: { - ...requestData, - ...(!requestData.b_size && { - b_size: settings.defaultPageSize, - }), - ...(page && { - b_start: requestData.b_size - ? data.b_size * (page - 1) - : settings.defaultPageSize * (page - 1), - }), - query: requestData?.query, - }, + op: settings.querystringSearchGet ? 'get' : 'post', + path: `${path}/@querystring-search${ + settings.querystringSearchGet + ? `?query=${encodeURIComponent(JSON.stringify(query))}` + : '' + }`, + data: settings.querystringSearchGet ? null : query, }, }; } diff --git a/src/config/index.js b/src/config/index.js index 60985f5e26..6833ff56b8 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -180,6 +180,7 @@ let config = { styleClassNameConverters, hashLinkSmoothScroll: false, styleClassNameExtenders, + querystringSearchGet: false, }, experimental: { addBlockButton: {