[TYPO3-Solr] Dynamically add fields during page rendering

Stephan Schuler Stephan.Schuler at netlogix.de
Thu Apr 26 13:29:26 CEST 2012


Hey there.


To sum it up:

I want to have some kind of SOLR_INLINE that can be used at any point in the TypoScript rendering process. I want to use it in TemplaVoila FCEs.

·         Each time it gets rendered it should add new content to the solrDocument.

·         It should be allowed to be used multiple times and create multivalued content


The real world example:

I’m trying to create kind of product detail pages that are no real product records but more like customized page records.
Product pages show some product properties, but besides the product title there is nearly no required product property. And on top of that, the frontend layout of a single product page is not fixed but be_users have to be able to edit them almost like regular content pages.

Out of this loose object definition, the solr has to be filled to provide usefull facets.

One of the problems I try to solve is a “multiple product details on one page” situation: There are some products that come with different variants, one example is a different “required operation temperature” when it comes to electronic components. Those different variants of a single product should be displayed on one page. The be_users should be able to create product detail pages “as they want to have them in the frontend”, which means they should have some kind of tab-layout in the backend to edit those different product variants side by side.

I’m going to use TemplaVoila and use FCEs to provide at least some fixed layout structure.

At the moment, I see two different solutions for this:


1.     I create some kind of SOLR_INLINE_MULTIVALUE cObject which extends the SOLR_MULTIVALUE.
In contrast to the original SOLR_MULTIVALUE object, my extended one does not return a serialized data structure but push the currently rendered data structure to a global “additionalFields” storage (let’s say $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['index.']['additionalFields.'], or something completely different).
This can be used during regular page rendering to collect any key/value pair.
When the page gets rendered indexed, the global, dynamically filled additionalFields storage can be merged and added to the solrDocument, just like it’s done with the existing one which is filled by plain typo script.
The problem I see is related to caching which might result in not having all the data I want to add to my index in all cache cases.


2.     The second solution is adding non-visible content to my frontend output.

This could be done by HTML5 data properties, created by my FCEs during regular page rendering.
I would implement my own tx_solr_SubstitutePageIndexer that searches the content for those data properties and add new fields to the document.


As you can see, I really try to avoid creating my own extension/plugin that only creates customized product records and renders them to the frontend.


Is one of my ideas the way to go or do I miss something very importent?
I would prefer the second one: Adding meta information to my HTML output all the time and implement my own metadata collector.


Regards,
Stephan.

Stephan Schuler
Web-Entwickler

Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
Website: media.netlogix.de<http://media.netlogix.de>

--
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Andernacher Straße 53 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de<mailto:info at netlogix.de> | Internet: www.netlogix.de<http://www.netlogix.de/>

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt


More information about the TYPO3-project-solr mailing list