Thanks for the response. Since it’s only a prototype I probably won’t bother with changing this behaviour unless it’s necessary. On a related point though, do you know why the facet settings for my Discover interface are being used by my usual search interface? My Discover.php class lives in the services/Search directory but is not being called by the normal search. So I think what’s happening is that getRecommendationSettings is being way too enthusiastic and getting the settings for Discover, even though Discover is not being called. The Discover settings are thus being passed to SideFacets and overwriting the Side Facets settings for the normal search. If I’m right, this seems like pretty bad behaviour and would essentially mean that you can’t use two recommendation modules differently anywhere in your system. It’s a bit strange if this kind of bug has existed without anyone noticing it, so if somebody else wants to test it, please do. I guess that the best way to fix it would be to make the getRecommendationsSettings() method somewhat context aware, but perhaps this would have knock on effects elsewhere. In general I think the getRecommendationSettings() method is in need of a bit of refactoring, as it seems silly that new search settings types need to be hardcoded in. Of course, this is likely only to be a problem for those users, like us, who make a lot of modifications.
Note I did a quick test of the bug by creating a new search type in searches.ini with a corresponding section in facets.ini and assignation in getRecommendationSettings():
AllFields = SideFacets:WhereOhWhere
language = Language
Lo and behold, the language facets is now the one being shown on my Search results page, even though there is no JamesConnolly class anywhere in my code. Of course it’s possible that some error on our side has introduced this bug, so other opinions are very welcome.
From: Demian Katz
Sent: 01 October 2012 17:23
To: Ronan McHugh; firstname.lastname@example.org
Subject: RE: [VuFind-Tech] Can't display more than one SideFacets Recommendation per page
Your theory is correct – the Smarty variables get assigned before the templates get rendered, so they are overwriting one another. I can’t think of a simple way to do this in 1.x without either duplicating code (i.e. use different variable names for different copies of the same module, as you suggested) or significantly changing the workflow for recommendation rendering (i.e. immediately render the templates to an array of HTML snippets in the search object’s getRecommendationsTemplates() method instead of passing an array of template names to render). This shouldn’t be a problem in 2.0 because each recommendation module gets rendered in its own separate context… but I realize that doesn’t help you right now with the legacy code!
Visit our free exhibitions
Tabhair cuairt ar ár dtaispeántais saor in aisce
The contents of this e-mail (including attachments) are private and confidential and may also be subject to legal privilege. It is intended only for the use of the addressee. If you are not the addressee, or the person responsible for delivering it to the addressee, you may not copy or deliver this e-mail or any attachments to anyone else or make any use of its contents; you should not read any part of this e-mail or any attachments. Unauthorised disclosure or communication or other use of the contents of this e-mail or any part thereof may be prohibited by law and may constitute a criminal offence. If you receive this e-mail by mistake please notify the system manager @ 6030219.
Tá an ríomhphost seo (agus aon iatán a ghabhann leis) príobháideach agus rúnda agus d’fhéadfadh go mbeadh eolas inti atá faoi phribhléid dhlíthiúil. Ní ceadmhach úsáid an ríomhphoist seo d’éinne ach don té ar seoladh chuige é. Mura duitse an ríomhphost seo nó an té atá freagrach as é a sheoladh, tá cosc ar chóipeáil agus ar sheachadadh an ríomhphoist seo agus aon iatán a ghabhann leis chuig éinne nó úsáid a bhaint as a bhfuil ann; ní ceart an ríomhphost seo nó aon iatán a léamh. D’fhéadfadh go mbeadh cosc iomlán dlíthiúil ar sceitheadh nó comhfhreagras nó aon úsáid eile gan chead ar a bhfuil sa ríomhphost seo agus d’fhéadfadh sé a bheith ina chion coiriúil. Má fuair tú an ríomhphost seo trí earráid, déan teagmháil le bainisteoir an chórais @6030219