TYPO3-Solr / ext-solr

A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
GNU General Public License v3.0
136 stars 248 forks source link

[FEATURE] Support stdWrap for all options below search #2712

Open DanielSiepmann opened 3 years ago

DanielSiepmann commented 3 years ago

Is your feature request related to a problem? Please describe. We wanna re use the EXT:solr functionality and submit searches via TypoScript. Therefore we need to build the query e.g. via cObjects TEXT or USER which is not possible right now.

Describe the solution you'd like I would propose to support stdWrap support to all properties below the search path.

Describe alternatives you've considered I'm not aware of an alternative.

Additional context Add any other context or screenshots about the feature request here.

Target versions 11.0.x

DanielSiepmann commented 3 years ago

Right now we apply the following patches:

diff --git a/Classes/System/Configuration/TypoScriptConfiguration.php b/Classes/System/Configuration/TypoScriptConfiguration.php
index 4e594cac..ab91fdf3 100644
--- a/Classes/System/Configuration/TypoScriptConfiguration.php
+++ b/Classes/System/Configuration/TypoScriptConfiguration.php
@@ -1123,7 +1123,12 @@ class TypoScriptConfiguration
      */
     public function getSearchInitializeWithQuery($defaultIfEmpty = '')
     {
-        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.initializeWithQuery', $defaultIfEmpty);
+        $result = $this->getValueByPathWithFallbackOrDefaultValueAndApplyStdWrap(
+            'plugin.tx_solr.search.initializeWithQuery',
+            'plugin.tx_solr.search.initializeWithQuery',
+            $defaultIfEmpty
+        );
+
         return (string)$result;
     }
diff --git a/Classes/System/Configuration/TypoScriptConfiguration.php b/Classes/System/Configuration/TypoScriptConfiguration.php
index 4e594cac..a4b60f94 100644
--- a/Classes/System/Configuration/TypoScriptConfiguration.php
+++ b/Classes/System/Configuration/TypoScriptConfiguration.php
@@ -1311,6 +1311,17 @@ class TypoScriptConfiguration
     public function getSearchQueryFilterConfiguration(array $defaultIfEmpty = [])
     {
         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.query.filter.', $defaultIfEmpty);
+
+        foreach ($result as $identifier => $value) {
+            $result[$identifier] = $this->renderContentElementOfConfigured(
+                'plugin.tx_solr.search.query.filter.' . $identifier,
+                $value
+            );
+            if (substr($identifier, -1) === '.') {
+                unset($result[$identifier]);
+            }
+        }
+
         return $result;
     }