diff --git a/.ddev/docker-compose.solr.yaml b/.ddev/docker-compose.solr.yaml index 8ce969b0f7222ea2c67561e6c914528c78e53d0b..be3ff04b432e16b9969db05da2a84420ebec812f 100644 --- a/.ddev/docker-compose.solr.yaml +++ b/.ddev/docker-compose.solr.yaml @@ -3,9 +3,9 @@ version: '3.6' services: solr: container_name: ddev-${DDEV_SITENAME}-solr - image: typo3solr/ext-solr:10.0.1 + image: typo3solr/ext-solr:11.0.3 restart: "no" - ports: + expose: - 8983 labels: com.ddev.site-name: ${DDEV_SITENAME} @@ -17,4 +17,9 @@ services: - "./solr:/opt/solr/server/solr" web: links: - - solr:$DDEV_HOSTNAME + - solr + +volumes: + # solr is a persistent Docker volume for this project's solr data + # the volume will be named ddev-_solr + solr: diff --git a/extensions/t3org_layout/Classes/Domain/Model/News.php b/extensions/t3org_layout/Classes/Domain/Model/News.php index 6b426280aedbcca841b055791fa7be4a0b29d246..1860b531a324db6691469922e2c5bf91973a2e55 100644 --- a/extensions/t3org_layout/Classes/Domain/Model/News.php +++ b/extensions/t3org_layout/Classes/Domain/Model/News.php @@ -23,7 +23,7 @@ class News extends \GeorgRinger\News\Domain\Model\News /** * @var string */ - protected $authorFeUser; + protected $authorFeUser = ''; /** * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\T3orgLayout\Domain\Model\Contributors> @@ -51,10 +51,15 @@ class News extends \GeorgRinger\News\Domain\Model\News $this->authorFeUser = $authorFeUser; } + public function getAuthorFeUser(): string + { + return $this->authorFeUser; + } + /** * @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser[] */ - public function getAuthorFeUser() + public function getAuthorFeUsers() { if (!$this->authorFeUser) { return []; diff --git a/extensions/t3org_layout/Classes/Slot/SolrSlot.php b/extensions/t3org_layout/Classes/Slot/SolrSlot.php new file mode 100644 index 0000000000000000000000000000000000000000..b5c80c92cb4f24d3ef730b3e85aca6024cb1862d --- /dev/null +++ b/extensions/t3org_layout/Classes/Slot/SolrSlot.php @@ -0,0 +1,23 @@ +getUsedQuery()) { + $filterQueries = $values['resultSet']->getUsedQuery()->getFilterQueries(); + unset($filterQueries['type']); + $values['resultSet']->getUsedQuery()->setFilterQueries($filterQueries); + $allValuesFoundWithoutFacet = (int)$values['resultSet']->getUsedSearch() + ->search($values['resultSet']->getUsedQuery()) + ->getParsedData()->response->numFound; + $values['allResultCountWithoutFacets'] = $values['resultSet']->getAllResultCount(); + if ($allValuesFoundWithoutFacet > 0) { + $values['allResultCountWithoutFacets'] = $allValuesFoundWithoutFacet; + } + } + + return [$values]; + } +} diff --git a/extensions/t3org_layout/Configuration/TypoScript/Ext/Solr.typoscript b/extensions/t3org_layout/Configuration/TypoScript/Ext/Solr.typoscript index 62ffb2e7fa7d90d731cb9b6e0ae53fa63f593d71..c639d821ddbd3b92006348ebe32a1f731cee3c0b 100644 --- a/extensions/t3org_layout/Configuration/TypoScript/Ext/Solr.typoscript +++ b/extensions/t3org_layout/Configuration/TypoScript/Ext/Solr.typoscript @@ -3,11 +3,9 @@ plugin.tx_solr { templateRootPaths { 10 = EXT:t3org_layout/Resources/Private/Templates/Solr } - partialRootPaths { 10 = EXT:t3org_layout/Resources/Private/Partials/Solr } - layoutRootPaths { 10 = EXT:t3org_layout/Resources/Private/Layouts/Solr } @@ -25,6 +23,38 @@ plugin.tx_solr { } boostQuery = (type:tx_sfeventmgt_domain_model_event)^200 } + + faceting > + faceting = 1 + faceting { + keepAllFacetsOnSelection = 1 + facets { + type { + field = type + label = Type + partialName = Tabs + renderingInstruction = CASE + renderingInstruction { + key.field = optionValue + + pages = TEXT + pages { + value = Pages + } + + tx_news_domain_model_news = TEXT + tx_news_domain_model_news { + value = News + } + + tx_sfeventmgt_domain_model_event = TEXT + tx_sfeventmgt_domain_model_event { + value = Events + } + } + } + } + } } index { diff --git a/extensions/t3org_layout/Resources/Private/Partials/News/List/Item.html b/extensions/t3org_layout/Resources/Private/Partials/News/List/Item.html index 0b3f82476f44362df6e9e09131c56a2bddf7b70b..74f21ced9657cd3dffc24da3fd1d57177a77c2ae 100644 --- a/extensions/t3org_layout/Resources/Private/Partials/News/List/Item.html +++ b/extensions/t3org_layout/Resources/Private/Partials/News/List/Item.html @@ -76,13 +76,10 @@
- - : + : - {category.title} - , - + {category.title},
@@ -97,11 +94,11 @@ - + - - + + @@ -119,7 +116,7 @@ - + {newsItem.author} diff --git a/extensions/t3org_layout/Resources/Private/Partials/Solr/Facets/Tabs.html b/extensions/t3org_layout/Resources/Private/Partials/Solr/Facets/Tabs.html new file mode 100644 index 0000000000000000000000000000000000000000..9ed4cd5783e7e6b78ae561b36ee96958ccb21031 --- /dev/null +++ b/extensions/t3org_layout/Resources/Private/Partials/Solr/Facets/Tabs.html @@ -0,0 +1,13 @@ + + + + + + diff --git a/extensions/t3org_layout/Resources/Private/Partials/Solr/Result/Facets.html b/extensions/t3org_layout/Resources/Private/Partials/Solr/Result/Facets.html new file mode 100644 index 0000000000000000000000000000000000000000..41a96f9024c4a88c464b031cb4b57e192d8a09d0 --- /dev/null +++ b/extensions/t3org_layout/Resources/Private/Partials/Solr/Result/Facets.html @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/extensions/t3org_layout/Resources/Private/Templates/News/News/Detail.html b/extensions/t3org_layout/Resources/Private/Templates/News/News/Detail.html index d9b40c2d1da016ae00b827e3f3be9be94b49de42..cc3e59c7cbdc180534fb2582f9ca390e05a58807 100644 --- a/extensions/t3org_layout/Resources/Private/Templates/News/News/Detail.html +++ b/extensions/t3org_layout/Resources/Private/Templates/News/News/Detail.html @@ -115,21 +115,19 @@ - {category.title} - , + {category.title}, - {category.title} - , + {category.title}, - + - - + + diff --git a/extensions/t3org_layout/Resources/Private/Templates/Solr/Search/Results.html b/extensions/t3org_layout/Resources/Private/Templates/Solr/Search/Results.html index b32206c48e8019f279fc913b655716aea92ff304..2e1692b3fdc238488bb1372ebebea7424e25bf36 100644 --- a/extensions/t3org_layout/Resources/Private/Templates/Solr/Search/Results.html +++ b/extensions/t3org_layout/Resources/Private/Templates/Solr/Search/Results.html @@ -49,8 +49,32 @@ - -
    +
    +
    +
    + + + + + + + +
    +
    + +
      diff --git a/extensions/t3org_layout/ext_localconf.php b/extensions/t3org_layout/ext_localconf.php index 7785394508acbbd47746128623bd28781a0018f3..6428362bb2f4aae8581ac2e7246610a8c7ea4d38 100644 --- a/extensions/t3org_layout/ext_localconf.php +++ b/extensions/t3org_layout/ext_localconf.php @@ -14,3 +14,12 @@ $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['SolrSuggest'] = \T3o\T3orgLayo $GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['classes']['Domain/Model/News'][] = 't3org_layout'; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['t3org_layout'] = \T3o\T3orgLayout\Hook\DataHandlerHook::class; + +// Solr slot +$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class); +$signalSlotDispatcher->connect( + \ApacheSolrForTypo3\Solr\Controller\SearchController::class, + 'resultsAction', + \T3o\T3orgLayout\Slot\SolrSlot::class, + 'addResultsWithoutFacets' +);