ext-solr icon indicating copy to clipboard operation
ext-solr copied to clipboard

[BUG] Use fallback solr connection for all languages

Open ayacoo opened this issue 3 years ago • 0 comments

Describe the bug Some context: We have a frontend-disabled language (ID 0) and a translation (e.g. Italian ID 7) for a root page. In a document indexer (outsourced SysFolder) the solr extension wants to fetch a connection from there and finds none. So far okay.

There is a connection fallback for ID 0 and not for other languages. We have been able to fix the point linked below with a line, but we are unsure whether this is the right way for the extension.

If the proposed code is OK, we can of course create a PR.

Expected behavior We would also expect a DefaultConnection for multilingualism.

Used versions (please complete the following information):

  • TYPO3 Version: 10.4.x
  • EXT:solr Version: 11.1.1

Additional context Related Code: https://github.com/TYPO3-Solr/ext-solr/blob/main/Classes/IndexQueue/Indexer.php#L565 Related PR https://github.com/TYPO3-Solr/ext-solr/pull/3068

Code

 Classes/IndexQueue/Indexer.php | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Classes/IndexQueue/Indexer.php b/Classes/IndexQueue/Indexer.php
index 7e1fc744..0ab155f9 100644
--- a/Classes/IndexQueue/Indexer.php
+++ b/Classes/IndexQueue/Indexer.php
@@ -562,9 +562,7 @@ class Indexer extends AbstractIndexer
         $defaultConnection = $this->connectionManager->getConnectionByPageId($rootPageId, $defaultLanguageUid, $item->getMountPointIdentifier());
         $translationConnections = $this->getConnectionsForIndexableLanguages($translationOverlays);
 
-        if ($defaultLanguageUid == 0) {
-            $solrConnections[0] = $defaultConnection;
-        }
+	$solrConnections[(int) $solrConfiguration['language']] = $defaultConnection;
 
         foreach ($translationConnections as $systemLanguageUid => $solrConnection) {
             $solrConnections[$systemLanguageUid] = $solrConnection;

ayacoo avatar Oct 22 '21 08:10 ayacoo