From ff510d25e46d68f26e443d70faaef30af7434acb Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 8 Nov 2024 14:54:03 +0100 Subject: [PATCH 1/2] Fix elastic client builder for connecting to elastic vm --- Classes/Common/ElasticClientBuilder.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Classes/Common/ElasticClientBuilder.php b/Classes/Common/ElasticClientBuilder.php index c2ab8a7..031024e 100644 --- a/Classes/Common/ElasticClientBuilder.php +++ b/Classes/Common/ElasticClientBuilder.php @@ -51,7 +51,7 @@ protected function autoconfig (): ElasticClientBuilder { $this->setBasicAuthentication('elastic', $this->password); } if ($this->caFilePath) { - $this->setSSLVerification($this->caFilePath); + $this->setCABundle($this->caFilePath); } return $this; @@ -65,7 +65,8 @@ private function setCaFilePath(): void } $this->caFilePath = $this->extConf-> - only('elastcCredentialsFilePath', 'elasticCaFileName')-> + sortKeysDesc()-> + only('elasticCredentialsFilePath', 'elasticCaFileName')-> implode('/'); } @@ -77,11 +78,13 @@ private function setPassword(): void } $passwordFilePath = $this->extConf-> + sortKeys()-> only('elasticCredentialsFilePath', 'elasticPwdFileName')-> implode('/'); $passwordFile = fopen($passwordFilePath, 'r') or die($passwordFilePath . ' not found. Check your extension\'s configuration'); + $size = filesize($passwordFilePath); - $this->password = $passwordFile->getContents(); + $this->password = trim(fread($passwordFile, $size)); } } From 21d4a79615f157ec3406e377d8e28163dcd8be1b Mon Sep 17 00:00:00 2001 From: thomas-sc Date: Mon, 11 Nov 2024 16:59:02 +0100 Subject: [PATCH 2/2] create filter tabs on search results and make multiple filter possible --- Classes/Common/QueryParamsBuilder.php | 7 +++--- Resources/Private/Language/de.locallang.xlf | 9 ++++++++ Resources/Private/Language/locallang.xlf | 10 +++++++- Resources/Private/Templates/Search/Index.html | 23 +++++++++++++++++-- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/Classes/Common/QueryParamsBuilder.php b/Classes/Common/QueryParamsBuilder.php index 2740f94..ae943af 100644 --- a/Classes/Common/QueryParamsBuilder.php +++ b/Classes/Common/QueryParamsBuilder.php @@ -52,14 +52,15 @@ public static function createElasticParams(string $bibIndex, array $searchParams // Todo: automate the creation of parameters if (isset($searchParams['f_itemType']) && $searchParams['f_itemType'] !== "") { - $params['body']['query']['bool']['filter']['term']['itemType.keyword'] = $searchParams['f_itemType']; + $params['body']['query']['bool']['filter'][] = ['term' => ['itemType.keyword' => $searchParams['f_itemType']]]; } if (isset($searchParams['f_place']) && $searchParams['f_place'] !== "") { - $params['body']['query']['bool']['filter']['term']['place.keyword'] = $searchParams['f_place']; + $params['body']['query']['bool']['filter'][] = ['term' => ['place.keyword' => $searchParams['f_place']]]; } if (isset($searchParams['f_date']) && $searchParams['f_date'] !== "") { - $params['body']['query']['bool']['filter']['term']['date.keyword'] = $searchParams['f_date']; + $params['body']['query']['bool']['filter'][] = ['term' => ['date.keyword' => $searchParams['f_date']]]; } + return $params; } diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 1c917b6..8308403 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -32,6 +32,15 @@ Filtermenü schließen + + Treffer + + + Ihre Suchparameter + + + Suchparameter "%s" entfernen + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 09c065d..a564e19 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -33,7 +33,15 @@ Filtermenü schließen - + + Treffer + + + Ihre Suchparameter + + + Suchparameter "%s" entfernen + diff --git a/Resources/Private/Templates/Search/Index.html b/Resources/Private/Templates/Search/Index.html index 1848566..14eb56a 100644 --- a/Resources/Private/Templates/Search/Index.html +++ b/Resources/Private/Templates/Search/Index.html @@ -6,12 +6,31 @@
- {totalItems} Treffer +
+ {totalItems} {f:translate(key: 'searchResults_hits_label', extensionName: 'liszt_common')} +
+ {_all} + + + + +
+