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

(-)a/admin/searchengine/elasticsearch/mappings.pl (-10 / +19 lines)
Lines 103-108 if ( $op eq 'edit' ) { Link Here
103
    my @mapping_facet       = $input->multi_param('mapping_facet');
103
    my @mapping_facet       = $input->multi_param('mapping_facet');
104
    my @mapping_suggestible = $input->multi_param('mapping_suggestible');
104
    my @mapping_suggestible = $input->multi_param('mapping_suggestible');
105
    my @mapping_search      = $input->multi_param('mapping_search');
105
    my @mapping_search      = $input->multi_param('mapping_search');
106
    my @mapping_filter      = $input->multi_param('mapping_filter');
106
    my @mapping_marc_field  = $input->multi_param('mapping_marc_field');
107
    my @mapping_marc_field  = $input->multi_param('mapping_marc_field');
107
    my @faceted_field_names = $input->multi_param('display_facet');
108
    my @faceted_field_names = $input->multi_param('display_facet');
108
109
Lines 153-158 if ( $op eq 'edit' ) { Link Here
153
            my $mapping_suggestible = $mapping_suggestible[$i];
154
            my $mapping_suggestible = $mapping_suggestible[$i];
154
            my $mapping_sort        = $mapping_sort[$i];
155
            my $mapping_sort        = $mapping_sort[$i];
155
            my $mapping_search      = $mapping_search[$i];
156
            my $mapping_search      = $mapping_search[$i];
157
            my $mapping_filter      = $mapping_filter[$i];
156
158
157
            my $search_field = Koha::SearchFields->find({ name => $search_field_name }, { key => 'name' });
159
            my $search_field = Koha::SearchFields->find({ name => $search_field_name }, { key => 'name' });
158
            $mandatory_after++ if $search_field->mandatory && !defined $seen_fields{$search_field_name};
160
            $mandatory_after++ if $search_field->mandatory && !defined $seen_fields{$search_field_name};
Lines 166-177 if ( $op eq 'edit' ) { Link Here
166
                marc_type => $marc_type,
168
                marc_type => $marc_type,
167
                marc_field => $mapping_marc_field
169
                marc_field => $mapping_marc_field
168
            });
170
            });
169
            $search_field->add_to_search_marc_maps($marc_field, {
171
            $search_field->add_to_search_marc_maps(
170
                facet => $mapping_facet,
172
                $marc_field,
171
                suggestible => $mapping_suggestible,
173
                {
172
                sort => $mapping_sort,
174
                    facet       => $mapping_facet,
173
                search => $mapping_search
175
                    suggestible => $mapping_suggestible,
174
            });
176
                    sort        => $mapping_sort,
177
                    search      => $mapping_search,
178
                    filter      => $mapping_filter
179
                }
180
            );
175
        }
181
        }
176
        push @errors, { type => 'error', code => 'missing_mandatory_fields' } if $mandatory_after < $mandatory_before;
182
        push @errors, { type => 'error', code => 'missing_mandatory_fields' } if $mandatory_after < $mandatory_before;
177
    };
183
    };
Lines 227-241 for my $index_name (@index_names) { Link Here
227
    my $search_fields = Koha::SearchFields->search(
233
    my $search_fields = Koha::SearchFields->search(
228
        {
234
        {
229
            'search_marc_map.index_name' => $index_name,
235
            'search_marc_map.index_name' => $index_name,
230
            'search_marc_map.marc_type' => $marc_type,
236
            'search_marc_map.marc_type'  => $marc_type,
231
        },
237
        },
232
        {
238
        {
233
            join => { search_marc_to_fields => 'search_marc_map' },
239
            join      => { search_marc_to_fields => 'search_marc_map' },
234
            '+select' => [
240
            '+select' => [
235
                'search_marc_to_fields.facet',
241
                'search_marc_to_fields.facet',
236
                'search_marc_to_fields.suggestible',
242
                'search_marc_to_fields.suggestible',
237
                'search_marc_to_fields.sort',
243
                'search_marc_to_fields.sort',
238
                'search_marc_to_fields.search',
244
                'search_marc_to_fields.search',
245
                'search_marc_to_fields.filter',
239
                'search_marc_map.marc_field'
246
                'search_marc_map.marc_field'
240
            ],
247
            ],
241
            '+as' => [
248
            '+as' => [
Lines 243-253 for my $index_name (@index_names) { Link Here
243
                'suggestible',
250
                'suggestible',
244
                'sort',
251
                'sort',
245
                'search',
252
                'search',
253
                'filter',
246
                'marc_field'
254
                'marc_field'
247
            ],
255
            ],
248
            order_by => { -asc => [qw/name marc_field/] }
256
            order_by => { -asc => [qw/name marc_field/] }
249
         }
257
        }
250
     );
258
    );
251
259
252
    my @mappings;
260
    my @mappings;
253
    my @facetable_field_names = map { $_->name } @facetable_fields;
261
    my @facetable_field_names = map { $_->name } @facetable_fields;
Lines 263-268 for my $index_name (@index_names) { Link Here
263
            sort               => $s->get_column('sort') // 'undef', # To avoid warnings "Use of uninitialized value in lc"
271
            sort               => $s->get_column('sort') // 'undef', # To avoid warnings "Use of uninitialized value in lc"
264
            suggestible        => $s->get_column('suggestible'),
272
            suggestible        => $s->get_column('suggestible'),
265
            search             => $s->get_column('search'),
273
            search             => $s->get_column('search'),
274
            filter             => $s->get_column('filter'),
266
            facet              => $s->get_column('facet'),
275
            facet              => $s->get_column('facet'),
267
            is_facetable       => ( grep { $_ eq $name } @facetable_field_names ) ? 1 : 0,
276
            is_facetable       => ( grep { $_ eq $name } @facetable_field_names ) ? 1 : 0,
268
        };
277
        };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt (-1 / +26 lines)
Lines 267-272 a.add, a.delete { Link Here
267
                                <th>Facetable</th>
267
                                <th>Facetable</th>
268
                                <th>Suggestible</th>
268
                                <th>Suggestible</th>
269
                                <th>Searchable</th>
269
                                <th>Searchable</th>
270
                                <th>Filter</th>
270
                                <th>Mapping</th>
271
                                <th>Mapping</th>
271
                                <th>&nbsp;</th>
272
                                <th>&nbsp;</th>
272
                                </tr>
273
                                </tr>
Lines 297-302 a.add, a.delete { Link Here
297
                                            <td>
298
                                            <td>
298
                                                <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
299
                                                <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
299
                                            </td>
300
                                            </td>
301
                                            <td>
302
                                                <input type="hidden" name="mapping_filter" value="[% mapping.filter | html %]" readonly />[% IF mapping.filter == 'punctuation' %]Punctuation[% END %]
303
                                            </td>
300
                                            <td data-search="[% mapping.marc_field | html %]">
304
                                            <td data-search="[% mapping.marc_field | html %]">
301
                                                <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
305
                                                <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
302
                                            </td>
306
                                            </td>
Lines 359-364 a.add, a.delete { Link Here
359
                                                [% END %]
363
                                                [% END %]
360
                                            </select>
364
                                            </select>
361
                                            </td>
365
                                            </td>
366
                                            <td>
367
                                                <select name="mapping_filter">
368
                                                    [% IF mapping.filter == 'punctuation' %]
369
                                                        <option value="">None</option>
370
                                                        <option value="punctuation" selected="selected">Punctuation</option>
371
                                                    [% ELSE %]
372
                                                        <option value="" selected="selected">None</option>
373
                                                        <option value="punctuation">Punctuation</option>
374
                                                    [% END %]
375
                                                </select>
376
                                            </td>
362
                                            <td data-search="[% mapping.marc_field | html %]">
377
                                            <td data-search="[% mapping.marc_field | html %]">
363
                                                <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
378
                                                <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
364
                                            </td>
379
                                            </td>
Lines 420-425 a.add, a.delete { Link Here
420
                                            [% END %]
435
                                            [% END %]
421
                                        </select>
436
                                        </select>
422
                                    </td>
437
                                    </td>
438
                                    <td>
439
                                        <select name="mapping_filter">
440
                                            [% IF mapping.filter == 'punctuation' %]
441
                                                <option value="">None</option>
442
                                                <option value="punctuation" selected="selected">Punctuation</option>
443
                                            [% ELSE %]
444
                                                <option value="" selected="selected">None</option>
445
                                                <option value="punctuation">Punctuation</option>
446
                                            [% END %]
447
                                        </select>
448
                                    </td>
423
                                    <td><input data-id="mapping_marc_field" type="text" /></td>
449
                                    <td><input data-id="mapping_marc_field" type="text" /></td>
424
                                    <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
450
                                    <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
425
                                </tr>
451
                                </tr>
426
- 

Return to bug 27153