[TYPO3-Solr] Index Qeue job wrong URL when cron used
Jigal van Hemert
jigal.van.hemert at typo3.org
Sun Feb 8 16:55:20 CET 2015
Hi,
On 08/02/2015 12:01, Robert W wrote:
> Thank you for the response. We have multiple domains running on the same
> TYPO3 instance. we have typolink.forceAbsoluteUrl = 1 for that reason.
> If we make this absolute, it is our understanding that it will cause
> problems with searching multiple domains.
When the index queue worker task is started by the cronjob (no by a
backend user) it runs in command line context. In that situation there
are no server variables available to properly create absolute URLs.
In the index queue TypoScript configuration you should therefore set
forceAbsoluteUrl to 0
> A litle background:
> When in the main domain, the user should be able to search the main
> domain and all subdomains. When the user is inside a subdomain, they
> should only see results for what is indexed in the subdomain. We have a
> main search field which appears on all site pages. When inside a
> subdomain, there is a second search field which only searches the
> subdomain.
>
>
> Question - are there settings we can put in the Typoscript for
> tx_solr.index.queue which will be picked up by the
> solr/Scheduler/IndexQueueWorkerTask protected function
> initializeHttpHost method? To resolve this problem
If you have several domains in your installation (assuming they all have
their own page tree in the installation), each has its domain record.
In the solr index there is a field with the site (domain) name and a
field with the relative URL.
In the configuration of the search results there is a a section which
determines how the links in the results are built
(plugin.tx_solr.search.results.fieldRenderingInstructions) here you can
create the absolute links. Example:
plugin.tx_solr.search.results.fieldRenderingInstructions.url.pages {
field = url
dataWrap = http://{field:site}/|
htmlSpecialChars = 1
htmlSpecialChars.preserveEntities = 1
}
There are of course other ways to combine the site with the URL; this
was just a simple example. If you use a typolink configuration in the
fieldRenderingInstructions with the uid to a single view page of news,
the links are probably correct. The reason is of course that in these
cases the links are generated during the rendering of the search
results. We are now in frontend context and all the server variables for
generating URLs are present.
--
Jigal van Hemert
TYPO3 CMS Active Contributor
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-project-solr
mailing list