Glad I could help, and sorry for the mess!

 

I don’t think there’s anything we’ll need for the trunk from what you’re doing – it sounds like your changes are fairly localized, and I wouldn’t want you to waste time trying to clean up the old mess when we have already (at least partially) done that work for 2.0.  However, if you find something that is clearly a bug (as opposed to simply confusing design), fixes are always appreciated.  Just don’t worry too much about larger architectural issues – since 1.x will be end of lifed soon, there’s not too much point in trying to improve it architecturally; better to focus those kinds of efforts on 2.0.

 

- Demian

 

From: Ronan McHugh [mailto:rmchugh@nli.ie]
Sent: Wednesday, October 03, 2012 8:38 AM
To: Demian Katz; vufind-tech@lists.sourceforge.net
Subject: RE: [VuFind-Tech] Can't display more than one SideFacets Recommendation per page

 

Ok, no wonder I was confused. I’ll give that a shot when I get a minute. Do you want something for the trunk?

 

Thanks for the help,

 

Ronan

 


From: Demian Katz [mailto:demian.katz@villanova.edu]
Sent: 03 October 2012 13:36
To: Ronan McHugh; vufind-tech@lists.sourceforge.net
Subject: RE: [VuFind-Tech] Can't display more than one SideFacets Recommendation per page

 

Ugh, this part of the 1.x code is really confusing.

 

The $searchType variable in getRecommendationSettings() does refer to the search index.

 

The issue is that there is also a $this->searchType property, which has nothing to do with the $searchType variable, that tells you which module is being used.  The property is initialized in SearchObject_Solr::init().

 

I think you just need to modify SearchObject_Solr::init() to set $this->searchType based on your custom module, then adjust your if statement to account for both $searchType and $this->searchType.

 

You might also want to look through the search object code to see how else $this->searchType is used.  You may need to make some additional tweaks to ensure that things like search history links and paging mechanisms work properly for your custom module.

 

And once again, though I know it doesn’t help you now, I will state for the record that this situation is significantly improved in 2.0 through a combination of more logical subclassing and more consistent naming (within the new search object code, I’ve tried to be consistent about using “search type” to mean “basic” or “advanced” and “search handler” to describe indexes like “all fields”, “title”, etc.).  It’s sometimes difficult to describe these things clearly, so there is probably room for further improvement…  but it’s definitely better than the organically-grown tangle that we have in 1.x.

 

- Demian

 

From: Ronan McHugh [mailto:rmchugh@nli.ie]
Sent: Wednesday, October 03, 2012 8:10 AM
To: Demian Katz; vufind-tech@lists.sourceforge.net
Subject: RE: [VuFind-Tech] Can't display more than one SideFacets Recommendation per page

 

Hi Demian,

 

It’s not a custom method, simply an addition to the existing method:

 

        if ($searchType

            && isset($searchSettings['DiscoverRecommendations'][$searchType]))

            {

                $recommend['discover'] = $searchSettings['DiscoverRecommendations'][$searchType];

            }

 

I thought that $searchType referred to the search index (allfields, author etc) rather than the specific module. If so, wouldn’t it make more sense to create a new variable to hold module information and leave $searchType as it is?

 

Cheers,

 

Ronan


From: Demian Katz [mailto:demian.katz@villanova.edu]
Sent: 02 October 2012 17:53
To: Ronan McHugh; vufind-tech@lists.sourceforge.net
Subject: RE: [VuFind-Tech] Can't display more than one SideFacets Recommendation per page

 

Could you share your custom getRecommendationSettings() method?  I think that might shed some light on what is going on.

 

I suspect that this all relates to the nasty $this->searchType logic in the 1.x search objects.  The logic for a bunch of different areas of the code are all collapsed into a single Solr search object, and this is differentiated by if statements within the class.  To work within this structure, you probably need to modify SearchObject_Solr::init() to set searchType based on the currently loaded module, and then modify SearchObject_Solr::getRecommendationSettings() to only load settings related to your module when searchType is set appropriately.

 

Needless to say, this is one of the things I tried to improve in 2.0 – special cases like the author module are now handled by their own subclasses of the Solr search object, so related logic is better grouped and I think it should be easier to add new custom modules.  I’m not sure if this completely covers your suggestions about refactoring getRecommendationsSettings, but I think it might at least address part of the problem.

 

- Demian

 

From: Ronan McHugh [mailto:rmchugh@nli.ie]
Sent: Tuesday, October 02, 2012 5:57 AM
To: Demian Katz; vufind-tech@lists.sourceforge.net
Subject: RE: [VuFind-Tech] Can't display more than one SideFacets Recommendation per page

 

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

 

 

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