Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] solr_path_read does not work properly #3043

Open
Tracked by #3376
dkd-kaehm opened this issue Sep 30, 2021 · 3 comments
Open
Tracked by #3376

[BUG] solr_path_read does not work properly #3043

dkd-kaehm opened this issue Sep 30, 2021 · 3 comments

Comments

@dkd-kaehm
Copy link
Collaborator

dkd-kaehm commented Sep 30, 2021

Describe the bug
There are to many confusions about "/solr/" path segment for connection configurations.
Current code base is inconsistent and should be refactored.
The Site configuration has already split settings for path and core, so we should propagate them as is to the node initialization.

We should remove the processing/splitting from:

$path = (string)$path;
$elements = explode('/', trim($path, '/'));
$coreName = (string)array_pop($elements);
// Remove API version
array_pop($elements);
// The path should always have the same format!
$path = trim(implode('/', $elements), '/');

and concatenation to "path":

'path' =>
SiteUtility::getConnectionProperty($typo3Site, 'path', $languageUid, 'read', '/solr/') .
SiteUtility::getConnectionProperty($typo3Site, 'core', $languageUid, 'read', 'core_en') . '/' ,

and propagate the path and core as is without any processing.

Used versions (please complete the following information):

  • TYPO3 Version: [e.g. 10.4]
  • EXT:solr Version: [e.g. 11.1.x]

Additional context
Discussion started on https://typo3.slack.com/archives/C02FF05Q4/p1632990610130900
and #3041

The text in Site module "I.e. if you use Hosted-Solr.com the path inside the admin panel. Should not contain "/solr/".
" is wrong and vice versa...

@etnicoliver
Copy link

Hello,

I think we encounter a problem related to this point. We put the path "/solr852/" in the field "solr_path_read" (Site module) and it does not seem to be taken into account.
The result is "Could not ping solr server, can not check version http://oursolrserver.com:8990/solr852/solr/core_cfwb/"
I don't know why there is "/solr/" in the middle, the correct path is /solr852/core_cfwb/.

We tested ext:solr version 11.1.2, same problem in the 11.1.1. But the old version 11.0.3 works juste fine in production.
Our solr server version is 8.5.2.
Typo3 version is 10.4.21

Does anyone else have the same problem?

Thank you.

@dkd-kaehm
Copy link
Collaborator Author

Does anyone else have the same problem?

All who uses the Solr servers within a path or behind proxies.
Please use /solr852/solr/ in solr_path_read.
The bad thing is that mentioned above array_pop($elements); cuts the latest element from path.

@stat1x
Copy link

stat1x commented Feb 27, 2023

Same problem here.
The given workaround does not seem to work in my case.

stat1x pushed a commit to stat1x/ext-solr that referenced this issue Feb 27, 2023
…path)

Fixes TYPO3-Solr#3043

diff --git a/Classes/System/Solr/Node.php b/Classes/System/Solr/Node.php
index 78f4ecee..ac2a0b16 100644
--- a/Classes/System/Solr/Node.php
+++ b/Classes/System/Solr/Node.php
@@ -48,22 +48,13 @@ class Node extends Endpoint
        ?string $username = null,
         ?string $password = null
     ) {
-        $path = (string)$path;
-        $elements = explode('/', trim($path, '/'));
-        $coreName = (string)array_pop($elements);
-        // Remove API version
-        array_pop($elements);
-
-        // The path should always have the same format!
-        $path = trim(implode('/', $elements), '/');
-
         $options = [
             'scheme' => $scheme,
             'host' => $host,
             'port' => $port,
-            'path' => '/' . $path,
+	    'context' => dirname($path),
             'collection' => null,
-            'core' => $coreName,
+            'core' => basename($path),
             'leader' => false,
         ];
dkd-kaehm pushed a commit to dkd-friedrich/ext-solr that referenced this issue Oct 6, 2023
Removes deprecated class ApacheSolrForTypo3\Solr\System\Solr\Node
and it's usages.

- Replace deprecated Node class with Endpoint
- Replace getUsername/getPassword with getAuthentication()
- Change SolrConnection->getNode() to SolrConnection->getEndpoint

Resolves: TYPO3-Solr#3630, TYPO3-Solr#3043
Replaces: TYPO3-Solr#3518
dkd-kaehm pushed a commit to dkd-friedrich/ext-solr that referenced this issue Oct 6, 2023
Removes deprecated class ApacheSolrForTypo3\Solr\System\Solr\Node
and it's usages.

- Replace deprecated Node class with Endpoint
- Replace getUsername/getPassword with getAuthentication()
- Change SolrConnection->getNode() to SolrConnection->getEndpoint

Resolves: TYPO3-Solr#3630, TYPO3-Solr#3043
Replaces: TYPO3-Solr#3518
dkd-kaehm pushed a commit that referenced this issue Oct 6, 2023
Removes deprecated class ApacheSolrForTypo3\Solr\System\Solr\Node
and it's usages.

- Replace deprecated Node class with Endpoint
- Replace getUsername/getPassword with getAuthentication()
- Change SolrConnection->getNode() to SolrConnection->getEndpoint

Resolves: #3630, #3043
Replaces: #3518
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants