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

Multiple domains on the same root page #1804

Open stegmatze opened 6 years ago

stegmatze commented 6 years ago

Hi there, I have a problem with multiple domains on the same root page. There are 5 languages with separate solr cores and separate domains. The languages/cores are configured like this: https://forge.typo3.org/projects/extension-solr/wiki/Multi_Language_Handling Indexing works fine except for the domains, solr only uses the first of the domain records on my root page, not the ones configured for the languages.

TYPO3 7.6.23 Solr 4.10.4 EXT:solr 5.1.1

sfsmfc commented 6 years ago

I will do a patch for this.

nabossha commented 6 years ago

@sfsmfc is there a timeframe for a patch-release?

stegmatze commented 6 years ago

We used absolute links when rendering the result to solve this. For EXT:solr 6.x we did it like this:


plugin.tx_solr.search.results.fieldRenderingInstructions.url {
    pages = TEXT
    pages {
        typolink {
            parameter.field = uid
            returnLast = url
            forceAbsoluteUrl = 1
        }
    }
}
sfsmfc commented 6 years ago

If you use the "right" realurl config and absolute urls, it should be worked.

Therefore I think no more solution is needed.

lgescobar commented 6 years ago

I had the same problem one day ago and came up with a custom PHP class which implements PageIndexerDataUrlModifier and overrides the domain by using the RealUrl _DOMAINS|encode configuration. This also avoids some HTTP redirects when indexing pages.

alandolsi commented 6 years ago

is there a solution for this issues, ? I can't get it to work.

irnnr commented 6 years ago

@lgescobar mind sharing your solution here for others to use?

alandolsi commented 6 years ago

For me was a bad real url configuration (many thanks to sfsmfc ), here is my solution: TYPO3 SOLR Multi Domain Configuration with RealUrl https://git.landolsi.de/snippets/166 https://git.landolsi.de/snippets/167 https://git.landolsi.de/snippets/168

https://gist.github.com/alandolsi/18cd6271adefba8780e39e3d74afab82

timohund commented 6 years ago

@alandolsi thx for sharing this

lgescobar commented 5 years ago

That's the only thing I can share at the moment.

In ext_localconf.php:

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['IndexQueuePageIndexer']['dataUrlModifier'] =
    \ACME\SolrExtras\IndexQueue\PageIndexerDataUrlModifier::class;

Class:

<?php
namespace ACME\SolrExtras\IndexQueue;

class PageIndexerDataUrlModifier implements \ApacheSolrForTypo3\Solr\IndexQueue\PageIndexerDataUrlModifier
{
    /**
     * Modifies the given data url
     *
     * $urlData = [
     *      'item' => $item,
     *      'scheme' => $scheme,
     *      'host' => $host,
     *      'path' => $path,
     *      'pageId' => $pageId,
     *      'language' => $language
     * ]
     *
     * @param string $pageUrl the current data url.
     * @param array $urlData An array of url data
     * @return string the final data url
     */
    public function modifyDataUrl($pageUrl, array $urlData)
    {
        $encodeLangConfs = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DOMAINS']['encode'] ?? null;

        return modifyUrl($pageUrl, $encodeLangConfs);
    }
}