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():

 

Searches.ini

[JamesConnolly]

AllFields[]         = SideFacets:WhereOhWhere

Facets.ini

[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.

 

Any thoughts?

 

Ronan

 


From: Demian Katz [mailto:demian.katz@villanova.edu]
Sent: 01 October 2012 17:23
To: Ronan McHugh; vufind-tech@lists.sourceforge.net
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!

 

- Demian

 

From: Ronan McHugh [mailto:rmchugh@nli.ie]
Sent: Monday, October 01, 2012 11:53 AM
To: vufind-tech@lists.sourceforge.net
Subject: [VuFind-Tech] Can't display more than one SideFacets Recommendation per page

 

Hello,

 

I’m working on a new browse-esque interface which will present users with multiple routes into the catalogue based on the idea of a “Generous Interface” (http://www.slideshare.net/mtchl/generous-interfaces) similar to the European Library’s Discover Portal (http://www.theeuropeanlibrary.org/tel4/discover). The basic way I’m doing this is through recommendation modules, including facets. These facets are derived through an empty search of the collection. In order to make the interface look nice, I want to have the facets in different zones, rather than simply a long line of text on the side of the page. So, I’ll have one set of facets for format, one set of facets for genre, each in a different box on the page.

 

In my searches.ini I have something like this:

 

[DiscoverRecommendations]

AllFields[]          = SideFacets:DiscoverA

AllFields[]          = SideFacets:DiscoverB

 

With corresponding sections in my facets.ini file:

 

[DiscoverA]

format             = Format

[DiscoverB]

genre_facet        = Genre

 

I then call these recommendations in my Discover.php and assign them to the interface. However, for some reason, the interface displays two copies of one facet rather than one of each. What’s worse, when I try to run a normal search, the facets from the Discover interface are being displayed, rather than the facets for my normal Search from the [Results] section in facets.ini. Attached is a screenshot to make this somewhat more understandable.

 

I have tried a bit of debugging and found that the parameters are being passed in fine to the module and thence to Solr, so I think what might be happening is that smarty is getting a bit confused about the variables being passed in. If I try to do one TopFacets and one SideFacets it seems to work ok. If this is a smarty thing, I guess the only way I can fix it is by creating a secondary template and assigning some variables to that, but that sounds messy. Does anyone know what might be going on and have some ideas for fixing it?

 

Thanks,

 

Ronan

 

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

 


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