Bugzilla – Attachment 50292 Details for
Bug 12478
Elasticsearch support for Koha
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12478 Increasing test Coverage for Koha::SearchEngine::Elasticsearch::Search
Bug-12478-Increasing-test-Coverage-for-KohaSearchE.patch (text/plain), 2.51 KB, created by
Nick Clemens (kidclamp)
on 2016-04-15 22:42:29 UTC
(
hide
)
Description:
Bug 12478 Increasing test Coverage for Koha::SearchEngine::Elasticsearch::Search
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2016-04-15 22:42:29 UTC
Size:
2.51 KB
patch
obsolete
>From fb1caa71d209c4d8445a443a7ad0da0a7394b372 Mon Sep 17 00:00:00 2001 >From: Chris Cormack <chrisc@catalyst.net.z> >Date: Thu, 14 Apr 2016 21:27:10 +0000 >Subject: [PATCH] Bug 12478 Increasing test Coverage for > Koha::SearchEngine::Elasticsearch::Search > >Before this patch it was 24.6%, after it is 64% > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/SearchEngine/Elasticsearch/Search.pm | 6 +++--- > t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t | 11 ++++++++++- > 2 files changed, 13 insertions(+), 4 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm >index 0950139..cfdad81 100644 >--- a/Koha/SearchEngine/Elasticsearch/Search.pm >+++ b/Koha/SearchEngine/Elasticsearch/Search.pm >@@ -43,7 +43,7 @@ use C4::Context; > use Koha::ItemTypes; > use Koha::AuthorisedValues; > use Koha::SearchEngine::QueryBuilder; >- >+use MARC::Record; > use Catmandu::Store::ElasticSearch; > > use Data::Dumper; #TODO remove >@@ -120,8 +120,8 @@ sub count { > Catmandu::Store::ElasticSearch->new( %$params, trace_calls => 0, ) ) > unless $self->store; > >- my $searcher = $self->store->bag->searcher(query => $query); >- my $count = $searcher->count(); >+ my $search = $self->store->bag->search( %$query); >+ my $count = $search->total() || 0; > return $count; > } > >diff --git a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >index 8b41492..9361b4c 100644 >--- a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >+++ b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >@@ -17,7 +17,7 @@ > use strict; > use warnings; > >-use Test::More tests => 5; # last test to print >+use Test::More tests => 10; # last test to print > use Koha::SearchEngine::Elasticsearch::QueryBuilder; > > my $builder = Koha::SearchEngine::Elasticsearch::QueryBuilder->new( { index => 'mydb' } ); >@@ -37,3 +37,12 @@ ok( my $query = $builder->build_query('easy'), 'Build a search query'); > > ok( my $results = $searcher->search( $query) , 'Do a search ' ); > >+ok( my $marc = $searcher->json2marc( $results->first ), 'Convert JSON to MARC'); >+ >+is (my $count = $searcher->count( $query ), 0 , 'Get a count of the results, without returning results '); >+ >+ok ($results = $searcher->search_compat( $query ), 'Test search_compat' ); >+ >+ok (($results,$count) = $searcher->search_auth_compat ( $query ), 'Test search_auth_compat' ); >+ >+is ( $count = $searcher->count_auth_use($searcher,1), 0, 'Testing count_auth_use'); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12478
:
29204
|
31128
|
31129
|
33136
|
33137
|
33138
|
33139
|
33140
|
33141
|
35654
|
40903
|
42030
|
42031
|
42032
|
42033
|
42062
|
42063
|
42064
|
42065
|
42066
|
42067
|
42068
|
42069
|
42392
|
42393
|
43127
|
43128
|
43129
|
43130
|
43131
|
43132
|
43133
|
43134
|
43140
|
43141
|
43142
|
43148
|
43345
|
43346
|
43347
|
43348
|
43349
|
43350
|
43351
|
43352
|
43373
|
47767
|
47768
|
50115
|
50159
|
50211
|
50212
|
50213
|
50214
|
50245
|
50246
|
50291
|
50292