Bug 8209: "Did you mean?" from authorities
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 19 Jul 2012 12:02:40 +0000 (08:02 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 13 Sep 2012 09:34:28 +0000 (11:34 +0200)
commit8471158160b760f614be3b4f3c39297808b117d6
treec2afdffd8f8da52b930588f5860ec75b0c7b0ca9
parentce6898655e8e01e8505c5b7746f028b3386b8715
Bug 8209: "Did you mean?" from authorities

One of the ideas behind authority records is that users who search for
one term should have related terms (according to the authority file)
suggested to them. At the moment, Koha doesn't do that. Adding an
authority searching step to regular searches and displaying any
suggestions in a "Did you mean" bar at the top of the results would be
very useful.

This commit adds a Koha::SuggestionEngine class which is in charge of
getting suggestions from individual suggestion engine plugins, which
much be in the Koha::SuggestionEngine::Plugin::* namespace, and extend
Koha::SuggestionEngine::Base. Suggestions are loaded asynchronously
using AJAX, and a link to a page with suggestions is provided for users
with Javascript turned off.

The AuthorityFile suggestion engine plugin looks up the specified search
terms in the authority file and then suggests searches for records using
matching authorities.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Rebased 2 August 2012 and incorporated QA feedback

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Test plan:
- Verified database update added system preference correctly,
  pref defaults to OFF
- Verified search results and detail pages in OPAC and staff
  still worked the same as before
  * for no results
  * with results
- Activated system preference and tested various searches
  * Searches from simple search
  * Searches from advanced search
  * Search links in records
- Deactivated Javascript - verified fallback works correctly

Notes:

- Suggested terms can include autorities with no linked records.
- When combining more than one search option using advanced search
  this results in "no suggestions" more often. Feature works best
  from simple search.

Overall great feature making use of authorities in a user friendly way!

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Rebased on latest master 2012-09-10
Signed-off-by: wajasu <matted-34813@mypacks.net>
15 files changed:
C4/AuthoritiesMarc.pm
Koha/SuggestionEngine.pm [new file with mode: 0644]
Koha/SuggestionEngine/Base.pm [new file with mode: 0644]
Koha/SuggestionEngine/Plugin/AuthorityFile.pm [new file with mode: 0644]
Koha/SuggestionEngine/Plugin/Null.pm [new file with mode: 0644]
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref
koha-tmpl/opac-tmpl/prog/en/css/opac.css
koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
koha-tmpl/opac-tmpl/prog/en/modules/svc/suggestion.tt [new file with mode: 0644]
opac/opac-search.pl
opac/svc/suggestion [new file with mode: 0755]
t/SuggestionEngine.t [new file with mode: 0755]
t/SuggestionEngine_AuthorityFile.t [new file with mode: 0755]