Bugzilla – Attachment 158492 Details for
Bug 17897
Koha::SearchMappingManager - Simplify search mapping modifications
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17897: Add search_marc_to_field.filter to SearhMappingManager
0001-Bug-17897-Add-search_marc_to_field.filter-to.patch (text/plain), 5.75 KB, created by
Emmi Takkinen
on 2023-11-06 06:36:21 UTC
(
hide
)
Description:
Bug 17897: Add search_marc_to_field.filter to SearhMappingManager
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2023-11-06 06:36:21 UTC
Size:
5.75 KB
patch
obsolete
>From 19eed6dbfc3506b34ffc015b337046d9317c3c1d Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Mon, 6 Nov 2023 08:34:46 +0200 >Subject: [PATCH] Bug 17897: Add search_marc_to_field.filter to > SearhMappingManager > >Methods in SearchMappingManager didn't take into account >search_marc_to_field.filter indtroduced in bug 27153. > >To test, prove t/db_dependent/Koha/SearchEngine/ElasticSearch.t > >Sponsored-by: Koha-Suomi Oy >--- > Koha/SearchMappingManager.pm | 9 +++++++-- > t/db_dependent/Koha/SearchEngine/ElasticSearch.t | 12 ++++++++---- > 2 files changed, 15 insertions(+), 6 deletions(-) > >diff --git a/Koha/SearchMappingManager.pm b/Koha/SearchMappingManager.pm >index bc7e231704..77ddd0ba42 100644 >--- a/Koha/SearchMappingManager.pm >+++ b/Koha/SearchMappingManager.pm >@@ -46,6 +46,7 @@ and their respective Koha::Objects in a correct manner. > $search_field->get_column('facet'), > $search_field->get_column('suggestible'), > $search_field->get_column('sort'), >+ $search_field->get_column('filter'), > $search_field->get_column('marc_type'), > $search_field->get_column('marc_field'), > ); >@@ -79,6 +80,7 @@ sub get_search_mappings { > 'search_marc_to_fields.suggestible', > 'search_marc_to_fields.sort', > 'search_marc_to_fields.search', >+ 'search_marc_to_fields.filter', > 'search_marc_map.marc_type', > 'search_marc_map.marc_field', > ], >@@ -87,6 +89,7 @@ sub get_search_mappings { > 'suggestible', > 'sort', > 'search', >+ 'filter', > 'marc_type', > 'marc_field', > ], >@@ -120,7 +123,8 @@ sub flush { > marc_field => '024a', > facet => 1, > suggestible => 1, >- sort => 1}); >+ sort => 1, >+ filter => 'filter'}); > > =cut > >@@ -144,7 +148,8 @@ sub add_mapping { > $p->{facet} = $params->{facet} if $params->{facet}; > $p->{suggestible} = $params->{suggestible} if $params->{suggestible}; > $p->{sort} = $params->{sort} if $params->{sort}; >- $p->{search} = $params->{search} if $params->{search}; >+ $p->{search} = $params->{search} if $params->{search}; >+ $p->{filter} = $params->{filter} if $params->{filter}; > Koha::Database->schema->resultset('SearchMarcToField')->update_or_create($p); > } > >diff --git a/t/db_dependent/Koha/SearchEngine/ElasticSearch.t b/t/db_dependent/Koha/SearchEngine/ElasticSearch.t >index f0d749f69c..22c9c6641f 100755 >--- a/t/db_dependent/Koha/SearchEngine/ElasticSearch.t >+++ b/t/db_dependent/Koha/SearchEngine/ElasticSearch.t >@@ -60,7 +60,8 @@ subtest 'reset_elasticsearch_mappings() tests' => sub { > marc_field => '024a', > facet => 1, > suggestible => 1, >- sort => 1}); >+ sort => 1, >+ filter => 'punctuation'}); > ok($rv, 'Given a mapping table with a custom search field'); > eval { > $rv = Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings(); >@@ -78,7 +79,7 @@ subtest 'reset_elasticsearch_mappings() tests' => sub { > > subtest 'get_search_mappings() tests' => sub { > >- plan tests => 13; >+ plan tests => 14; > > my ($mappings, $mapping); > >@@ -92,6 +93,7 @@ subtest 'get_search_mappings() tests' => sub { > is($mapping->get_column('suggestible'), '0', 'And the search mapping "suggestible" matches'); > is($mapping->get_column('sort'), '1', 'And the search mapping "sort" matches'); > is($mapping->get_column('search'), '1', 'And the search mapping "search" matches'); >+ is($mapping->get_column('filter'), '', 'And the searc mapping "filter" matches'); > is($mapping->get_column('marc_type'), 'marc21', 'And the search mapping "marc_type" matches'); > is($mapping->get_column('marc_field'), '007_/0', 'And the search mapping "marc_field" matches'); > >@@ -117,7 +119,8 @@ subtest 'add_mapping() tests' => sub { > marc_field => '024a', > facet => 1, > suggestible => 1, >- sort => 1}); >+ sort => 1, >+ filter => 'punctuation'}); > $rv = Koha::SearchMappingManager::add_mapping({name => 'ln-test', > label => 'original language', > type => '', >@@ -126,7 +129,8 @@ subtest 'add_mapping() tests' => sub { > marc_field => '024a', > facet => 1, > suggestible => 1, >- sort => 1}); >+ sort => 1, >+ filter => 'punctuation'}); > ok(1, "When the same search mapping is added twice"); > > $mappings = Koha::SearchMappingManager::get_search_mappings({index_name => 'biblios', name => 'ln-test'}); >-- >2.34.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 17897
:
58942
|
65392
|
102475
|
102476
|
115320
|
115321
|
115322
|
143744
|
157224
|
157282
|
157283
|
157284
|
158487
|
158488
|
158489
|
158490
|
158491
|
158492
|
158561
|
158562
|
158563
|
158564