Bugzilla – Attachment 28627 Details for
Bug 12347
Search performance improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12347: Unit tests should be updated to new API
Bug-12347-Unit-tests-should-be-updated-to-new-API.patch (text/plain), 13.20 KB, created by
Tomás Cohen Arazi (tcohen)
on 2014-06-02 23:10:35 UTC
(
hide
)
Description:
Bug 12347: Unit tests should be updated to new API
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2014-06-02 23:10:35 UTC
Size:
13.20 KB
patch
obsolete
>From 6b5c17999611f84f76136c8d921787567121fdeb Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Mon, 2 Jun 2014 19:43:11 -0300 >Subject: [PATCH] Bug 12347: Unit tests should be updated to new API > >This patch updates t/db_dependent/Search.t to acknowledge the API change. >Now getRecords returns MARC::Record objects and thus there's no need to >have separate DOM and GRS-1 test cases (at least for it). > >To test: >- Apply both bug's patches >- Run > prove -v t/db_dependent/Search.t >=> SUCCESS: all tests pass > >Best regards >To+ > >Sponsored-by: Universidad Nacional de Cordoba >--- > t/db_dependent/Search.t | 87 ++++++++++++++----------------------------------- > 1 file changed, 24 insertions(+), 63 deletions(-) > >diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t >index 46d63f4..8f9d29e 100644 >--- a/t/db_dependent/Search.t >+++ b/t/db_dependent/Search.t >@@ -17,6 +17,7 @@ use open ':std', ':encoding(utf8)'; > > use Test::More tests => 4; > use Test::MockModule; >+use Test::Deep; > use MARC::Record; > use File::Spec; > use File::Basename; >@@ -349,8 +350,10 @@ sub run_marc21_search_tests { > !defined $results_hashref->{biblioserver}->{RECORDS}->[1] && > !defined $results_hashref->{biblioserver}->{RECORDS}->[2] && > !defined $results_hashref->{biblioserver}->{RECORDS}->[3] && >- !defined $results_hashref->{biblioserver}->{RECORDS}->[4] && >- $results_hashref->{biblioserver}->{RECORDS}->[5] eq $record5, "getRecords cursor works"); >+ !defined $results_hashref->{biblioserver}->{RECORDS}->[4], >+ "getRecords cursor works (undef first 5 results)"); >+ cmp_deeply( $results_hashref->{biblioserver}->{RECORDS}->[5], >+ $record5, "getRecords cursor works"); > > ( undef, $results_hashref, $facets_loop ) = > getRecords('ti:book', 'ti:book', [], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >@@ -360,82 +363,45 @@ sub run_marc21_search_tests { > getRecords('au:Lessig', 'au:Lessig', [], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, 'ccl', undef); > is($results_hashref->{biblioserver}->{hits}, 4, "getRecords title search for 'Australia' matched right number of records"); > >-if ( $indexing_mode eq 'dom' ) { > ( undef, $results_hashref, $facets_loop ) = > getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >- ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Efectos del ambiente/ && >- MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' && >- MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ >+ ok($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper() =~ m/^Efectos del ambiente/ && >+ $results_hashref->{biblioserver}->{RECORDS}->[7]->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' && >+ $results_hashref->{biblioserver}->{RECORDS}->[18]->title_proper() =~ m/^Indicadores de resultados identificados/ > , "Simple relevance sorting in getRecords matches old behavior"); > > ( undef, $results_hashref, $facets_loop ) = > getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >- ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/ && >- MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[6],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ && >- MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' >+ ok($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper() =~ m/la enfermedad laboral\^ies$/ && >+ $results_hashref->{biblioserver}->{RECORDS}->[6]->title_proper() =~ m/^Indicadores de resultados identificados/ && >+ $results_hashref->{biblioserver}->{RECORDS}->[18]->title_proper() eq 'World health statistics 2009^ien' > , "Simple ascending author sorting in getRecords matches old behavior"); > > ( undef, $results_hashref, $facets_loop ) = > getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >- ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' && >- MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[12],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ && >- MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/ >+ ok($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper() eq 'World health statistics 2009^ien' && >+ $results_hashref->{biblioserver}->{RECORDS}->[12]->title_proper() =~ m/^Indicadores de resultados identificados/ && >+ $results_hashref->{biblioserver}->{RECORDS}->[18]->title_proper() =~ m/la enfermedad laboral\^ies$/ > , "Simple descending author sorting in getRecords matches old behavior"); > > ( undef, $results_hashref, $facets_loop ) = > getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >- ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies' && >- MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ && >- MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ >+ ok($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper() eq 'Manual de higiene industrial^ies' && >+ $results_hashref->{biblioserver}->{RECORDS}->[7]->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ && >+ $results_hashref->{biblioserver}->{RECORDS}->[18]->title_proper() =~ m/^Indicadores de resultados identificados/ > , "Simple ascending publication date sorting in getRecords matches old behavior"); > > ( undef, $results_hashref, $facets_loop ) = > getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >- ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Estado de salud/ && >- MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' && >- MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies' >+ ok($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper() =~ m/^Estado de salud/ && >+ $results_hashref->{biblioserver}->{RECORDS}->[7]->title_proper() eq 'World health statistics 2009^ien' && >+ $results_hashref->{biblioserver}->{RECORDS}->[18]->title_proper() eq 'Manual de higiene industrial^ies' > , "Simple descending publication date sorting in getRecords matches old behavior"); > >-} elsif ( $indexing_mode eq 'grs1' ){ >- ( undef, $results_hashref, $facets_loop ) = >- getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >- ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/^Efectos del ambiente/ && >- MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' && >- MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/^Indicadores de resultados identificados/ >- , "Simple relevance sorting in getRecords matches old behavior"); >- >- ( undef, $results_hashref, $facets_loop ) = >- getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >- ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/la enfermedad laboral\^ies$/ && >- MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[6])->title_proper() =~ m/^Indicadores de resultados identificados/ && >- MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() eq 'World health statistics 2009^ien' >- , "Simple ascending author sorting in getRecords matches old behavior"); >- >- ( undef, $results_hashref, $facets_loop ) = >- getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >- ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() eq 'World health statistics 2009^ien' && >- MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[12])->title_proper() =~ m/^Indicadores de resultados identificados/ && >- MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/la enfermedad laboral\^ies$/ >- , "Simple descending author sorting in getRecords matches old behavior"); >- >- ( undef, $results_hashref, $facets_loop ) = >- getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >- ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() eq 'Manual de higiene industrial^ies' && >- MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ && >- MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/^Indicadores de resultados identificados/ >- , "Simple ascending publication date sorting in getRecords matches old behavior"); >- >- ( undef, $results_hashref, $facets_loop ) = >- getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); >- ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/^Estado de salud/ && >- MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() eq 'World health statistics 2009^ien' && >- MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() eq 'Manual de higiene industrial^ies' >- , "Simple descending publication date sorting in getRecords matches old behavior"); >-} > > ( undef, $results_hashref, $facets_loop ) = > getRecords('books', 'books', [ 'relevance' ], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, undef, 1); >- $record = MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0]); >+ $record = $results_hashref->{biblioserver}->{RECORDS}->[0]; > is($record->title_proper(), 'Books', "Scan returned requested item"); > is($record->subfield('100', 'a'), 2, "Scan returned correct number of records matching term"); > # Time to test buildQuery and searchResults too. >@@ -578,12 +544,7 @@ if ( $indexing_mode eq 'dom' ) { > > ($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); > is($results_hashref->{biblioserver}->{hits}, 19, "Weighted query returned correct number of results"); >- if ($indexing_mode eq 'grs1') { >- is(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first"); >- } else { >- local $TODO = "Query weighting does not behave exactly the same in DOM vs. GRS"; >- is(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first"); >- } >+ is($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first"); > > $QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryRemoveStopwords = 0; > $QueryAutoTruncate = 1; >@@ -914,12 +875,12 @@ sub run_unimarc_search_tests { > } > > subtest 'MARC21 + GRS-1' => sub { >- plan tests => 104; >+ plan tests => 105; > run_marc21_search_tests('grs1'); > }; > > subtest 'MARC21 + DOM' => sub { >- plan tests => 104; >+ plan tests => 105; > run_marc21_search_tests('dom'); > }; > >-- >1.9.1
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 12347
:
28623
| 28627 |
28628