0e7f7ab051
This is an interface for quick and efficient browsing through records. It presents a page at /cgi-bin/koha/opac-browse.pl that allows you to enter the prefix of an author, title, or subject and it'll give you a list of the options that match that. You can then scroll through these and select the one you're after. Selecting it provides a list of records that match that particular search. To Test: 1 - Apply patches 2 - Update database (updatedatabase on kohadevbox) 3 - Compile the CSS https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client yarn build --view=opac on kohadevbox 4 - Enable the new syspref OpacBrowseSearch 5 - Have ES running and some records in it SearchEngine syspref set to Elasticsearch 6 - Browse to opac home, click 'Browse search' link for your site) 7 - Test searching for author, title, and subject 8 - Verify that results are returned in expected order 9 - Experiment with fuzziness https://www.elastic.co/guide/en/elasticsearch/reference/5.6/common-options.html#fuzziness Options are: exact (0 edits), fuzzy (1 edit), very fuzzy (2 edits) 10 - Click any result and verify specific titles are correct 11 - Click through title to record and verify it is the correct record 12 - Test that disabling pref removes the link on the opac home Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
68 lines
2.1 KiB
Perl
Executable file
68 lines
2.1 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# Copyright 2015 Catalyst IT
|
|
#
|
|
# This file is part of Koha.
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it under the
|
|
# terms of the GNU General Public License as published by the Free Software
|
|
# Foundation; either version 3 of the License, or (at your option) any later
|
|
# version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with Koha; if not, write to the Free Software Foundation, Inc.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
use Modern::Perl;
|
|
|
|
use Test::More;
|
|
|
|
use_ok('Koha::SearchEngine::Elasticsearch::Browse');
|
|
|
|
# testing browse itself not implemented as it'll require a running ES
|
|
can_ok('Koha::SearchEngine::Elasticsearch::Browse',
|
|
qw/ _build_query browse /);
|
|
|
|
subtest "_build_query tests" => sub {
|
|
plan tests => 2;
|
|
|
|
my $browse = Koha::SearchEngine::Elasticsearch::Browse->new({index=>'dummy'});
|
|
my $q = $browse->_build_query('foo', 'title');
|
|
is_deeply($q, { size => 1,
|
|
suggest => {
|
|
suggestions => {
|
|
text => 'foo',
|
|
completion => {
|
|
field => 'title__suggestion',
|
|
size => 500,
|
|
fuzzy => {
|
|
fuzziness => 1,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, 'No fuzziness or size specified');
|
|
|
|
# Note that a fuzziness of 4 will get reduced to 2.
|
|
$q = $browse->_build_query('foo', 'title', { fuzziness => 4, count => 400 });
|
|
is_deeply($q, { size => 1,
|
|
suggest => {
|
|
suggestions => {
|
|
text => 'foo',
|
|
completion => {
|
|
field => 'title__suggestion',
|
|
size => 400,
|
|
fuzzy => {
|
|
fuzziness => 2,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, 'Fuzziness and size specified');
|
|
};
|
|
|
|
done_testing();
|