<<

NAME

Koha::SuggestionEngine - Dispatcher class for suggestion engines

SYNOPSIS

  use Koha::SuggestionEngine;
  my $suggestor = Koha::SuggestionEngine->new(%params);
  $suggestor->get_suggestions($search)

DESCRIPTION

Dispatcher class for retrieving suggestions. SuggestionEngines must extend Koha::SuggestionEngine::Base, be in the Koha::SuggestionEngine::Plugin namespace, and provide the following methods:

get_suggestions ($search) - get suggestions from the plugin for the specified search.

These methods may be overriden:

initialize (%params) - initialize the plugin

destroy () - destroy the plugin

These methods should not be overridden unless you are very sure of what you are doing:

new () - create a new plugin object

FUNCTIONS

new

    my $suggestor = Koha::SuggestionEngine->new(%params);

Create a new suggestor class. Available parameters are:

plugins

What plugin(s) to use. This must be an arrayref to a list of plugins. Plugins can be specified either with a complete class path, or, if they are in the Koha::SuggestionEngine::Plugin namespace, as only the plugin name, and "Koha::SuggestionEngine::Plugin" will be prepended to it before the plugin is loaded.

get_suggestions

    my $suggestions = $suggester->get_suggestions(\%params)

Get a list of suggestions based on the search passed in. Available parameters are:

search

Required. The search for which suggestions are desired.

count

Optional. The number of suggestions to retrieve. Defaults to 10.

AvailablePlugins

    my @available_plugins = Koha::SuggestionEngine::AvailablePlugins();

Get a list of available plugins.

<<