View | Details | Raw Unified | Return to bug 17897
Collapse All | Expand All

(-)a/Koha/SearchMappingManager.pm (-2 / +7 lines)
Lines 46-51 and their respective Koha::Objects in a correct manner. Link Here
46
            $search_field->get_column('facet'),
46
            $search_field->get_column('facet'),
47
            $search_field->get_column('suggestible'),
47
            $search_field->get_column('suggestible'),
48
            $search_field->get_column('sort'),
48
            $search_field->get_column('sort'),
49
            $search_field->get_column('filter'),
49
            $search_field->get_column('marc_type'),
50
            $search_field->get_column('marc_type'),
50
            $search_field->get_column('marc_field'),
51
            $search_field->get_column('marc_field'),
51
        );
52
        );
Lines 79-84 sub get_search_mappings { Link Here
79
                'search_marc_to_fields.suggestible',
80
                'search_marc_to_fields.suggestible',
80
                'search_marc_to_fields.sort',
81
                'search_marc_to_fields.sort',
81
                'search_marc_to_fields.search',
82
                'search_marc_to_fields.search',
83
                'search_marc_to_fields.filter',
82
                'search_marc_map.marc_type',
84
                'search_marc_map.marc_type',
83
                'search_marc_map.marc_field',
85
                'search_marc_map.marc_field',
84
            ],
86
            ],
Lines 87-92 sub get_search_mappings { Link Here
87
                'suggestible',
89
                'suggestible',
88
                'sort',
90
                'sort',
89
                'search',
91
                'search',
92
                'filter',
90
                'marc_type',
93
                'marc_type',
91
                'marc_field',
94
                'marc_field',
92
            ],
95
            ],
Lines 120-126 sub flush { Link Here
120
                                             marc_field => '024a',
123
                                             marc_field => '024a',
121
                                             facet => 1,
124
                                             facet => 1,
122
                                             suggestible => 1,
125
                                             suggestible => 1,
123
                                             sort => 1});
126
                                             sort => 1,
127
                                             filter => 'filter'});
124
128
125
=cut
129
=cut
126
130
Lines 144-150 sub add_mapping { Link Here
144
    $p->{facet}       = $params->{facet}       if $params->{facet};
148
    $p->{facet}       = $params->{facet}       if $params->{facet};
145
    $p->{suggestible} = $params->{suggestible} if $params->{suggestible};
149
    $p->{suggestible} = $params->{suggestible} if $params->{suggestible};
146
    $p->{sort}        = $params->{sort}        if $params->{sort};
150
    $p->{sort}        = $params->{sort}        if $params->{sort};
147
    $p->{search}        = $params->{search}        if $params->{search};
151
    $p->{search}      = $params->{search}      if $params->{search};
152
    $p->{filter}      = $params->{filter}      if $params->{filter};
148
    Koha::Database->schema->resultset('SearchMarcToField')->update_or_create($p);
153
    Koha::Database->schema->resultset('SearchMarcToField')->update_or_create($p);
149
}
154
}
150
155
(-)a/t/db_dependent/Koha/SearchEngine/ElasticSearch.t (-5 / +8 lines)
Lines 60-66 subtest 'reset_elasticsearch_mappings() tests' => sub { Link Here
60
                                                   marc_field => '024a',
60
                                                   marc_field => '024a',
61
                                                   facet => 1,
61
                                                   facet => 1,
62
                                                   suggestible => 1,
62
                                                   suggestible => 1,
63
                                                   sort => 1});
63
                                                   sort => 1,
64
                                                   filter      => 'punctuation'});
64
    ok($rv, 'Given a mapping table with a custom search field');
65
    ok($rv, 'Given a mapping table with a custom search field');
65
    eval {
66
    eval {
66
        $rv = Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings();
67
        $rv = Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings();
Lines 78-84 subtest 'reset_elasticsearch_mappings() tests' => sub { Link Here
78
79
79
subtest 'get_search_mappings() tests' => sub {
80
subtest 'get_search_mappings() tests' => sub {
80
81
81
    plan tests => 13;
82
    plan tests => 14;
82
83
83
    my ($mappings, $mapping);
84
    my ($mappings, $mapping);
84
85
Lines 92-97 subtest 'get_search_mappings() tests' => sub { Link Here
92
    is($mapping->get_column('suggestible'), '0',     'And the search mapping "suggestible" matches');
93
    is($mapping->get_column('suggestible'), '0',     'And the search mapping "suggestible" matches');
93
    is($mapping->get_column('sort'),        '1',   'And the search mapping "sort" matches');
94
    is($mapping->get_column('sort'),        '1',   'And the search mapping "sort" matches');
94
    is($mapping->get_column('search'),     '1',   'And the search mapping "search" matches');
95
    is($mapping->get_column('search'),     '1',   'And the search mapping "search" matches');
96
    is($mapping->get_column('filter'),     '', 'And the searc mapping "filter" matches');
95
    is($mapping->get_column('marc_type'),  'marc21', 'And the search mapping "marc_type" matches');
97
    is($mapping->get_column('marc_type'),  'marc21', 'And the search mapping "marc_type" matches');
96
    is($mapping->get_column('marc_field'), '007_/0', 'And the search mapping "marc_field" matches');
98
    is($mapping->get_column('marc_field'), '007_/0', 'And the search mapping "marc_field" matches');
97
99
Lines 117-123 subtest 'add_mapping() tests' => sub { Link Here
117
                                                   marc_field => '024a',
119
                                                   marc_field => '024a',
118
                                                   facet => 1,
120
                                                   facet => 1,
119
                                                   suggestible => 1,
121
                                                   suggestible => 1,
120
                                                   sort => 1});
122
                                                   sort => 1,
123
                                                   filter => 'punctuation'});
121
    $rv = Koha::SearchMappingManager::add_mapping({name => 'ln-test',
124
    $rv = Koha::SearchMappingManager::add_mapping({name => 'ln-test',
122
                                                   label => 'original language',
125
                                                   label => 'original language',
123
                                                   type => '',
126
                                                   type => '',
Lines 126-132 subtest 'add_mapping() tests' => sub { Link Here
126
                                                   marc_field => '024a',
129
                                                   marc_field => '024a',
127
                                                   facet => 1,
130
                                                   facet => 1,
128
                                                   suggestible => 1,
131
                                                   suggestible => 1,
129
                                                   sort => 1});
132
                                                   sort => 1,
133
                                                   filter => 'punctuation'});
130
    ok(1, "When the same search mapping is added twice");
134
    ok(1, "When the same search mapping is added twice");
131
135
132
    $mappings = Koha::SearchMappingManager::get_search_mappings({index_name => 'biblios', name => 'ln-test'});
136
    $mappings = Koha::SearchMappingManager::get_search_mappings({index_name => 'biblios', name => 'ln-test'});
133
- 

Return to bug 17897