From ee71c0389280a05ad1c26eecb4dd6ddfef5a1dbd Mon Sep 17 00:00:00 2001 From: Oleksandr Zhyian Date: Tue, 24 Dec 2024 09:38:50 +0200 Subject: [PATCH 1/3] feat: add option to include 'about' post meta field in search --- languages/fau-degree-program-output-de_DE.mo | Bin 15010 -> 15105 bytes languages/fau-degree-program-output-de_DE.po | 15 ++++++++---- .../fau-degree-program-output-de_DE_formal.mo | Bin 15015 -> 15110 bytes .../fau-degree-program-output-de_DE_formal.po | 15 ++++++++---- languages/fau-degree-program-output.pot | 13 +++++++---- .../scss/components/search/_search-form.scss | 4 ++++ .../Search/SearchableContentUpdater.php | 22 +++++++++++++++++- templates/search/text-input-search.php | 19 +++++++++++++++ 8 files changed, 73 insertions(+), 15 deletions(-) diff --git a/languages/fau-degree-program-output-de_DE.mo b/languages/fau-degree-program-output-de_DE.mo index e641745f9e9129972e5a0cc9ad5f41a45250350d..82ab8d810147ec89ba257ecfa79589032eb2f316 100644 GIT binary patch delta 3383 zcmYk-c~F&A7{~FWCCG9Cx#1O+ypRY=vLh%ekQ!lXZj*}U5@~>n3nG}x6+|-vv95}_ zq@hiJWNHy*Q?@uYlatP&Nx|P&+EP)o z($gOP@HWG7fapsM?`BK~&I;rY$BzzU!tgxy#w*rtA;$El@3xLXeln$~TdUBC>v0%1 zV=SIUKfKlXyT{z8!9U{+H6|Qma1dtTBRJPufj#KgV=vr|8lVmR@dQTV861GW+wL*^I|L?1N3H^Y5ab z_bF;Y?WhUeKux3yZ8oq5kk3;D@ zB8(Y<`KT@2fQfhn^?Qf?J+h}UkJF#lll&*ssN+N`w&4)`4F_UBmNys+Fc&Lv6dpwt z)g9CTnG}R3z5x4S18NHoB5N=wPz$<%Nq7sjkoZXQ@1`-4%26hk;nV1~{SMR(UAQ|1 zQ!pNjP!DLp1pE-w@gfez2ns?ee+IL#0W8sIo8gSRmg6G?*xT!5O`Zd4}Epq_Idl{rtgyK_aQsFiq8d-nw@ zrB_fh4I@3i8DlQ}rI?5B<2d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8&6i1maH-uuAc<(HiG?lkv;z*z9Vxh==sE$)^N*_v4q`X5|RRGa_+ diff --git a/languages/fau-degree-program-output-de_DE.po b/languages/fau-degree-program-output-de_DE.po index 1a03bec..74db9f7 100644 --- a/languages/fau-degree-program-output-de_DE.po +++ b/languages/fau-degree-program-output-de_DE.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: FAU Degree Program Output 0.0.4\n" "Report-Msgid-Bugs-To: https://github.com/RRZE-Webteam/FAU-Studium-Embed\n" -"POT-Creation-Date: 2024-07-18T12:59:56+00:00\n" -"PO-Revision-Date: 2024-07-18 16:07+0300\n" +"POT-Creation-Date: 2024-12-23T06:39:22+00:00\n" +"PO-Revision-Date: 2024-12-23 08:42+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: de_DE\n" @@ -11,7 +11,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.4.2\n" +"X-Generator: Poedit 3.5\n" "X-Domain: fau-degree-program-output\n" #. Plugin Name of the plugin @@ -527,16 +527,21 @@ msgstr "" "Die Studiengangsdaten werden gerade verarbeitet. Bitte versuche es in ein " "paar Minuten erneut." -#: templates/search/text-input-search.php:39 +#: templates/search/text-input-search.php:41 msgctxt "frontoffice: degree programs search form" msgid "Please enter search term..." msgstr "Bitte Suchbegriff eingeben…" -#: templates/search/text-input-search.php:47 +#: templates/search/text-input-search.php:49 msgctxt "frontoffice: degree programs search form" msgid "Search" msgstr "Suchen" +#: templates/search/text-input-search.php:69 +msgctxt "frontoffice: degree programs search form" +msgid "Also search in text" +msgstr "Auch im Text suchen" + #: templates/single-degree-program-short.php:37 #: templates/single-degree-program/details.php:25 msgctxt "frontoffice: single view" diff --git a/languages/fau-degree-program-output-de_DE_formal.mo b/languages/fau-degree-program-output-de_DE_formal.mo index a9dc04a3c19825a6b9a9d1f92ab38aff0e877735..380f9460f862e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ln(|4TZKi^ObuYX?pt`rEqLNt6@)h_?w{+Q+fPKH@1t2Tf;VJ<)L` zQQ!j^I$XR2W|{MKbV6=b$8GC=+)Yd-Hruvw__8fOi?2D!o+S55N)1G{Gt!fpxR=rr zViTc@_dfJ~z2a>0WP0X@+QNV4G@tY|dzwE\n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-07-18T12:59:56+00:00\n" +"POT-Creation-Date: 2024-12-23T06:39:22+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.9.0\n" "X-Domain: fau-degree-program-output\n" @@ -517,16 +517,21 @@ msgctxt "frontoffice: degree programs search form" msgid "The degree program data is being processed. Please try again in a few minutes." msgstr "" -#: templates/search/text-input-search.php:39 +#: templates/search/text-input-search.php:41 msgctxt "frontoffice: degree programs search form" msgid "Please enter search term..." msgstr "" -#: templates/search/text-input-search.php:47 +#: templates/search/text-input-search.php:49 msgctxt "frontoffice: degree programs search form" msgid "Search" msgstr "" +#: templates/search/text-input-search.php:69 +msgctxt "frontoffice: degree programs search form" +msgid "Also search in text" +msgstr "" + #: templates/single-degree-program-short.php:37 #: templates/single-degree-program/details.php:25 msgctxt "frontoffice: single view" diff --git a/resources/scss/components/search/_search-form.scss b/resources/scss/components/search/_search-form.scss index 27e4401..3c9c8ae 100644 --- a/resources/scss/components/search/_search-form.scss +++ b/resources/scss/components/search/_search-form.scss @@ -17,6 +17,10 @@ display: flex; } + &__options { + margin-top: 10px; + } + &__search-icon { width: 28px; height: 28px; diff --git a/src/Infrastructure/Search/SearchableContentUpdater.php b/src/Infrastructure/Search/SearchableContentUpdater.php index 5f4a247..50e03c0 100644 --- a/src/Infrastructure/Search/SearchableContentUpdater.php +++ b/src/Infrastructure/Search/SearchableContentUpdater.php @@ -17,6 +17,7 @@ final class SearchableContentUpdater { public const SEARCHABLE_CONTENT_KEY = 'fau_degree_program_searchable_content'; + public const SEARCHABLE_CONTENT_EXTENDED_KEY = 'fau_degree_program_searchable_content_extended'; public function __construct( private DegreeProgramCollectionRepository $degreeProgramCollectionRepository, @@ -68,6 +69,11 @@ private function update(CollectionCriteria $criteria): void self::SEARCHABLE_CONTENT_KEY . '_' . $code, $this->buildSearchableContent($rawView, $code) ); + update_post_meta( + $rawView->id()->asInt(), + self::SEARCHABLE_CONTENT_EXTENDED_KEY . '_' . $code, + $this->buildSearchableContentExtended($rawView, $code) + ); } } } @@ -83,10 +89,24 @@ private function buildSearchableContent( $parts = [ $rawView->title()->asString($languageCode), $rawView->subtitle()->asString($languageCode), - $rawView->content()->about()->description()->asString($languageCode), ...array_values($rawView->keywords()->asArrayOfStrings($languageCode)->getArrayCopy()), ]; return implode(' ', $parts); } + + /** + * @psalm-param LanguageCodes $languageCode + */ + private function buildSearchableContentExtended( + DegreeProgramViewRaw $rawView, + string $languageCode + ): string { + + $parts = [ + $rawView->content()->about()->description()->asString($languageCode), + ]; + + return implode(' ', $parts); + } } diff --git a/templates/search/text-input-search.php b/templates/search/text-input-search.php index dac0085..57c511c 100644 --- a/templates/search/text-input-search.php +++ b/templates/search/text-input-search.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Fau\DegreeProgram\Common\Infrastructure\TemplateRenderer\Renderer; use Fau\DegreeProgram\Output\Infrastructure\Component\Component; use Fau\DegreeProgram\Output\Infrastructure\Component\Icon; @@ -13,6 +14,7 @@ * name: string, * } $data * @var array $data + * @var Renderer $renderer */ [ @@ -58,4 +60,21 @@ class="c-degree-programs-searchform__input" ) ?> +
+ + render( + 'search/filter/checkbox-item', + [ + 'filterId' => 'extended', + 'label' => esc_html_x( + 'Also search in text', + 'frontoffice: degree programs search form', + 'fau-degree-program-output' + ), + 'value' => 'enable', + 'isSelected' => false, + ] + ) ?> + +
From ae00a9b28d6dde2d31196926433efbb11f39189e Mon Sep 17 00:00:00 2001 From: Oleksandr Zhyian Date: Tue, 24 Dec 2024 16:10:22 +0200 Subject: [PATCH 2/3] docs: update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fa2756..9cb487a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Keywords are indexed for searching. +- Introduce "Also search in text" option. ## [2.1.0] - 2024-09-06 From 76a2dae6315368036b81312109f381e294bbf5ad Mon Sep 17 00:00:00 2001 From: Oleksandr Zhyian Date: Thu, 26 Dec 2024 15:45:46 +0200 Subject: [PATCH 3/3] feat: exclude extended filter from being added to active filters --- resources/ts/filters/filters-handler.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/ts/filters/filters-handler.ts b/resources/ts/filters/filters-handler.ts index 511ac58..fd61545 100644 --- a/resources/ts/filters/filters-handler.ts +++ b/resources/ts/filters/filters-handler.ts @@ -8,6 +8,7 @@ import { updateDegreeProgramOverviewDataset } from '../degree-program-overview/d const FILTER_SELECTOR = '.c-filter-checkbox'; export const LANGUAGE_SKILLS_INPUT = 'german-language-skills-for-international-students'; +const EXTENDED_INPUT = 'extended'; const filters = document.querySelectorAll< HTMLElement >( FILTER_SELECTOR ); @@ -68,8 +69,10 @@ filters.forEach( ( filterControl ) => { } checkbox?.addEventListener( 'change', ( e ) => { - toggleActiveFilter( filterControl, checkbox ); - updateFiltersCount( checkbox ); + if ( ! checkbox.name.startsWith( EXTENDED_INPUT ) ) { + toggleActiveFilter( filterControl, checkbox ); + updateFiltersCount( checkbox ); + } if ( checkbox.name.startsWith( LANGUAGE_SKILLS_INPUT ) ) { languageCertificateCheckedCheckboxes += checkbox.checked ? 1 : -1;