How to construct this solr parameters with uri.typolink

1.2k Views Asked by At

How does it work if I want to construct the following structure with Typo3's Fluid uri.typolink viewhelper:

/de/suche/?tx_solr[q]=&tx_solr[filter][0]=result_type_filter:award

This is the viewhelper and data should go inside additionaParams, if I'm not wrong. {f:uri.typolink(parameter: 2881, addQueryString: 1, additionalParams: 'structureGoesHere')}

example:

{f:uri.typolink(parameter: 2881, addQueryString: 1, additionalParams: 'example')}

output:

/de/suche/?tx_solr%5Bq%5D=&example=

decoded:

/de/suche/?tx_solr[q]=&example=

I'm stuck the hard way... just using typo3 for the first time trying to wrap my head around everything, any help is much appreciated.

further explanation: (typo3, fluid, solr) you might ask yourself why do I need this specific structure... we reworked our solr facet architecture - first we used "top nav" buttons where we filtered results per page config - now we replaced this approach with facets for the counter of the specific facets in the top nav - so now we have to pass the correct facet as a parameter to know which results to display on reload (ajaxify does not work in this situation, its just for the side menu). This is were the uri.typolink approach finds use.

1

There are 1 best solutions below

0
On BEST ANSWER

Do you really need a typolink viewhelper, or could you also use the uri.page viewhelper?

uri.page viewhelper:

<f:uri.page pageUid="2881" additionalParams="{tx_solr: {q: '', filter: {0: 'result_type_filter:award'}}}" />

Or inline notation:

{f:uri.page(pageUid:'2881', additionalParams: '{tx_solr: {q: \'\', filter: {0: \'result_type_filter:award\'}}}')}

You have to nest an array to achieve tx_solr[filter][0] by:

filter: {0: 'result_type_filter:award'}