1 package Koha::SuggestionEngine::Base;
3 # Copyright 2012 C & P Bibliography Services
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 Koha::SuggestionEngine::Base - Base class for SuggestionEngine plugins
26 use base qw(Koha::SuggestionEngine::Base);
30 Base class for suggestion engine plugins. SuggestionEngines must
31 provide the following methods:
33 B<get_suggestions (\%param)> - get suggestions for the search described
34 in $param->{'search'}, and return them in a hashref with the suggestions
35 as keys and relevance as values.
37 B<NAME> - return a string with the name of the plugin.
39 B<VERSION> - return a string with the version of the plugin.
41 These methods may be overriden:
43 B<initialize (%params)> - initialize the plugin
45 B<destroy ()> - destroy the plugin
47 These methods should not be overridden unless you are very sure of what
50 B<new ()> - create a new plugin object
59 use base qw(Class::Accessor);
61 __PACKAGE__->mk_ro_accessors(qw( name version ));
62 __PACKAGE__->mk_accessors(qw( params ));
66 my $plugin = Koha::SuggestionEngine::Base->new;
75 my $self = $class->SUPER::new( {} ); #name => $class->NAME,
76 #version => $class->VERSION });
84 $plugin->initalize(%params);
86 Initialize a filter using the specified parameters.
94 #$self->params = $params;
112 =head2 get_suggestions
114 my $suggestions = $plugin->get_suggestions(\%param);
116 Return suggestions for the specified search.
120 sub get_suggestions {