From 8777b4162e2f0f5a5c3eafcdc6c69085e9131708 Mon Sep 17 00:00:00 2001 From: Cihan Andac Date: Mon, 24 Jun 2024 11:12:10 +0200 Subject: [PATCH] change: advanced search to trigger 'only artworks' button for the search results --- .../blocks/AdvancedSearch/AdvancedSearchView.jsx | 2 +- .../src/customizations/components/theme/Search/Search.jsx | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/blocks/AdvancedSearch/AdvancedSearchView.jsx b/frontend/src/components/blocks/AdvancedSearch/AdvancedSearchView.jsx index 9d4ecc6..9872bb7 100644 --- a/frontend/src/components/blocks/AdvancedSearch/AdvancedSearchView.jsx +++ b/frontend/src/components/blocks/AdvancedSearch/AdvancedSearchView.jsx @@ -108,7 +108,7 @@ const AdvancedSearch = () => { history.push( `/search?SearchableText=${encodeURIComponent( searchQuery, - )}&portal_type=artwork`, + )}&advancedsearch=true`, ); }; diff --git a/frontend/src/customizations/components/theme/Search/Search.jsx b/frontend/src/customizations/components/theme/Search/Search.jsx index 792e88b..c817013 100644 --- a/frontend/src/customizations/components/theme/Search/Search.jsx +++ b/frontend/src/customizations/components/theme/Search/Search.jsx @@ -228,6 +228,7 @@ class Search extends Component { currentUrlParams.delete('portal_type:list'); currentUrlParams.delete('hasPreviewImage'); currentUrlParams.delete('ObjOnDisplay'); + currentUrlParams.delete('advancedsearch'); if (this.state.onlyArtworks) { currentUrlParams.set('portal_type', 'artwork'); @@ -258,6 +259,12 @@ class Search extends Component { doSearch = () => { const options = qs.parse(this.props.history.location.search); + if ( + options?.advancedsearch === 'true' && + options.portal_type !== 'artwork' + ) { + this.handleCheckboxChange('onlyArtworks'); + } if (this.state.onlyArtworks) { options.portal_type = 'artwork';