diff --git a/Classes/Domain/Search/QueryFactory.php b/Classes/Domain/Search/QueryFactory.php index 310d34a..ef859e4 100644 --- a/Classes/Domain/Search/QueryFactory.php +++ b/Classes/Domain/Search/QueryFactory.php @@ -25,8 +25,8 @@ use Codappix\SearchCore\Configuration\ConfigurationContainerInterface; use Codappix\SearchCore\Configuration\ConfigurationUtility; use Codappix\SearchCore\Configuration\InvalidArgumentException; use Codappix\SearchCore\Connection\SearchRequestInterface; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\ArrayUtility; +use TYPO3\CMS\Core\Utility\GeneralUtility; class QueryFactory { @@ -122,9 +122,13 @@ class QueryFactory $matchExpression = [ 'type' => 'most_fields', 'query' => $searchRequest->getSearchTerm(), - 'fields' => GeneralUtility::trimExplode(',', $this->configuration->get('searching.fields.query')), ]; + $fieldsToQuery = GeneralUtility::trimExplode(',', $this->configuration->getIfExists('searching.fields.query'), true); + if (!empty($fieldsToQuery)) { + $matchExpression['fields'] = $fieldsToQuery; + } + $minimumShouldMatch = $this->configuration->getIfExists('searching.minimumShouldMatch'); if ($minimumShouldMatch) { $matchExpression['minimum_should_match'] = $minimumShouldMatch; diff --git a/Configuration/TypoScript/setup.txt b/Configuration/TypoScript/setup.txt index d3051c1..6144195 100644 --- a/Configuration/TypoScript/setup.txt +++ b/Configuration/TypoScript/setup.txt @@ -26,7 +26,8 @@ plugin { searching { fields { - query = _all + # Default query fields (leave empty for all) + query = } } } diff --git a/Resources/Private/Templates/Search/Search.html b/Resources/Private/Templates/Search/Search.html index dc9e6b2..cfc737e 100644 --- a/Resources/Private/Templates/Search/Search.html +++ b/Resources/Private/Templates/Search/Search.html @@ -1,13 +1,20 @@ - + + - - - - - {result.id} [{result.type}] - {result.hit._source.search_title} - -
-
+