9 use_ok('Koha::SuggestionEngine');
12 my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'ExplodedTerms' ] } );
13 is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
15 my $result = $suggestor->get_suggestions({search => 'Cookery'});
17 ok((grep { $_->{'search'} eq 'su-na=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-br=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-rl=Cookery' } @$result), "Suggested correct alternatives for keyword search 'Cookery'");
19 $result = $suggestor->get_suggestions({search => 'su:Cookery'});
21 ok((grep { $_->{'search'} eq 'su-na=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-br=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-rl=Cookery' } @$result), "Suggested correct alternatives for subject search 'Cookery'");
23 $result = $suggestor->get_suggestions({search => 'nt:Cookery'});
25 is(scalar @$result, 0, "No suggestions for fielded search");
27 $result = $suggestor->get_suggestions({search => 'ccl=su:Cookery'});
29 is(scalar @$result, 0, "No suggestions for CCL search");