3 [% USE AuthorisedValues %]
5 [% PROCESS 'i18n.inc' %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>[% FILTER collapse %]
8 [% t("Search engine configuration (Elasticsearch)") | html %] ›
9 [% t("Administration") | html %] ›
10 [% t("Koha") | html %]
12 [% INCLUDE 'doc-head-close.inc' %]
13 [% Asset.css("lib/datatables/rowReorder.dataTables.min.css") | $raw %]
21 <body id="admin_searchengine_mappings" class="admin">
22 [% WRAPPER 'header.inc' %]
23 [% INCLUDE 'prefs-admin-search.inc' %]
26 [% WRAPPER 'sub-header.inc' %]
27 [% WRAPPER breadcrumbs %]
28 [% WRAPPER breadcrumb_item %]
29 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
31 [% WRAPPER breadcrumb_item bc_active= 1 %]
32 <span>Search engine configuration (Elasticsearch)</span>
34 [% END #/ WRAPPER breadcrumbs %]
35 [% END #/ WRAPPER sub-header.inc %]
37 <div class="main container-fluid">
39 <div class="col-sm-10 col-sm-push-2">
41 [% INCLUDE 'messages.inc' %]
43 [% FOR m IN messages %]
44 <div class="dialog [% m.type | html %]">
46 [% CASE 'error_on_update' %]
47 [% tx("An error occurred when updating mappings: {message}.", { message = m.message }) | html %]
48 [% CASE 'error_on_delete' %]
49 [% t("An error occurred when deleting the existing mappings. Nothing has been changed!") | $raw %]
50 [% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %]
51 [% CASE 'invalid_field_weight' %]
52 [% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %]
53 [% CASE 'missing_mandatory_fields' %]
54 [% t("You attempted to delete all mappings for a required index, you must leave at least one mapping") | $raw %]
55 [% CASE 'error_on_update_es_mappings' %]
56 [% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %]
57 [% CASE 'reindex_required' %]
58 [% tx("Index '{index}' needs to be reindexed.", { index = m.index }) | html %]
59 [% CASE 'recreate_required' %]
60 [% tx("Index '{index}' needs to be recreated.", { index = m.index }) | html %]
61 [% CASE 'success_on_update' %]
62 [% t("Mappings updated successfully.") | $raw %]
63 [% CASE 'success_on_reset' %]
64 [% t("Mappings have been reset successfully.") | $raw %]
65 [% CASE 'elasticsearch_disabled' %]
66 [% t("Elasticsearch is currently disabled.") | $raw %]
73 <h1>Search engine configuration (Elasticsearch)</h1>
76 <div class="dialog alert">
77 Changes have not been applied. Please check the following values:
79 [% FOREACH e IN errors %]
81 [% IF ( e.type == "malformed_mapping" ) %]
82 <span>The value "[% e.value | html %]" is not supported for mappings</span>
83 [% ELSIF ( e.type == "no_mapping" ) %]
84 <span>There is no mapping for the index [% e.value | html %]</span>
92 [% IF reset_confirm %]
93 <div class="dialog alert">
94 <h3>The current mappings you see on the screen will be erased and replaced by the mappings in the mappings.yaml file.</h3>
96 [% INCLUDE 'csrf-token.inc' %]
97 <input type="hidden" name="op" value="cud-reset_confirmed" />
98 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, reset mappings</button>
102 <button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not reset mappings</button>
108 <i class="fa fa-exclamation"></i>
109 <strong>Warning:</strong> Any changes to the configuration will only take effect after a full reindex. Until then searching may not work correctly.
111 <p><strong>Weight:</strong> define weight as a positive number. Higher numbers indicate increased relevancy.
112 <strong>Note that fields weighting works only for simple search.</strong></p>
114 <li>Only search fields mapped with biblios can be weighted</li>
115 <li>Search will boost/increase weighted field(s) relevancy</li>
119 <form id="es_mappings" method="post">
120 [% INCLUDE 'csrf-token.inc' %]
122 [% WRAPPER tabs id= "tabs" %]
124 [% WRAPPER tabs_nav %]
125 [% WRAPPER tab_item tabname= "search_fields" bt_active= 1 %] Search fields [% END %]
126 [% FOREACH index IN indexes %]
127 [% SWITCH index.index_name %]
129 [% WRAPPER tab_item tabname= "mapping_biblios" %] <span>Bibliographic records</span> [% END %]
130 [% CASE 'authorities' %]
131 [% WRAPPER tab_item tabname= "mapping_authorities" %] <span>Authorities</span> [% END %]
134 [% END # /WRAPPER tabs_nav %]
136 [% WRAPPER tab_panels %]
137 [% WRAPPER tab_panel tabname="search_fields" bt_active= 1 %]
138 <table class="search_fields" id="search_fields_table" data-index_name="search_fields">
146 <th colspan="2">Searchable</th>
150 <th colspan="5" class="NoSort"> </th>
151 <th class="NoSort">Staff interface</th>
152 <th class="NoSort">OPAC</th>
157 [% FOREACH search_field IN all_search_fields %]
159 <td data-order="[% search_field.name | html %]">
160 [% IF search_field.mandatory %]
161 <input type="text" name="search_field_name" value="[% search_field.name | html %]" readonly />
163 <input type="text" name="search_field_name" value="[% search_field.name | html %]" />
167 [% search_field.aliases.join(', ') | html %]
169 <td data-order="[% search_field.label | html %]">
170 [% IF search_field.mandatory %]
171 <input type="text" name="search_field_label" value="[% search_field.label | html %]" readonly />
173 <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
176 <td data-order="[% search_field.type | html %]">
177 [% IF search_field.mandatory %]
178 <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
179 <select name="search_field_type" disabled>
181 <select name="search_field_type">
183 <option value=""></option>
184 [% IF search_field.type == "string" %]
185 <option value="string" selected="selected">String</option>
187 <option value="string">String</option>
189 [% IF search_field.type == "date" %]
190 <option value="date" selected="selected">Date</option>
192 <option value="date">Date</option>
194 [% IF search_field.type == "year" %]
195 <option value="year" selected="selected">Year</option>
197 <option value="year">Year</option>
199 [% IF search_field.type == "number" %]
200 <option value="number" selected="selected">Number</option>
202 <option value="number">Number</option>
204 [% IF search_field.type == "boolean" %]
205 <option value="boolean" selected="selected">Boolean</option>
207 <option value="boolean">Boolean</option>
209 [% IF search_field.type == "sum" %]
210 <option value="sum" selected="selected">Sum</option>
212 <option value="sum">Sum</option>
214 [% IF search_field.type == "isbn" %]
215 <option value="isbn" selected="selected">ISBN</option>
217 <option value="isbn">ISBN</option>
219 [% IF search_field.type == "stdno" %]
220 <option value="stdno" selected="selected">Std. Number</option>
222 <option value="stdno">Std. Number</option>
224 [% IF search_field.type == "callnumber" %]
225 <option value="callnumber" selected="selected">Call Number</option>
227 <option value="callnumber">Call Number</option>
229 [% IF search_field.type == "geo_point" %]
230 <option value="geo_point" selected="selected">Geo point</option>
232 <option value="geo_point">Geo point</option>
236 <td data-order="[% search_field.weight | html %]">
237 [% IF search_field.mapped_biblios %]
238 <input type="text" inputmode="decimal" pattern="[0-9\.]*" name="search_field_weight" value="[% search_field.weight | html %]" />
240 <input type="text" name="search_field_weight" value="">
244 <select name="search_field_staff_client">
245 [% IF search_field.staff_client %]
246 <option value="1" selected="selected">Yes</option>
247 <option value="0">No</option>
249 <option value="1">Yes</option>
250 <option value="0" selected="selected">No</option>
255 <select name="search_field_opac">
256 [% IF search_field.opac %]
257 <option value="1" selected="selected">Yes</option>
258 <option value="0">No</option>
260 <option value="1">Yes</option>
261 <option value="0" selected="selected">No</option>
266 [% IF search_field.is_mapped %]
267 <a class="btn btn-default btn-xs disabled delete-search-field" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a>
269 <a class="btn btn-default btn-xs delete-search-field" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a>
276 <tr data-type="search-field">
278 <input type="text" data-id="search_field_name"/>
282 <input type="text" data-id="search_field_label"/>
285 <select data-id="search_field_type">
286 <option value=""></option>
287 <option value="string">String</option>
288 <option value="date">Date</option>
289 <option value="year">Year</option>
290 <option value="number">Number</option>
291 <option value="boolean">Boolean</option>
292 <option value="sum">Sum</option>
293 <option value="isbn">ISBN</option>
294 <option value="stdno">Std. Number</option>
298 <input type="text" data-id="search_field_weight" value="">
301 <select data-id="search_field_staff_client">
302 <option value="1">Yes</option>
303 <option value="0">No</option>
307 <select data-id="search_field_opac">
308 <option value="1">Yes</option>
309 <option value="0">No</option>
312 <td><a class="btn btn-default btn-xs add-search-field"><i class="fa fa-plus"></i> Add</a></td>
317 [% FOREACH index IN indexes %]
318 [% WRAPPER tab_panel tabname="mapping_${ index.index_name }" %]
319 <table class="mappings" data-index_name="[% index.index_name | html %]" data-ordering="false" id="mapping_[% index.index_name | html %]_table">
322 <th>Search field</th>
333 [% FOREACH mapping IN index.mappings %]
334 [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %]
337 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
338 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
339 [% mapping.search_field_name | html %]
340 [% IF mapping.search_field_label != mapping.search_field_name %] ([% mapping.search_field_label | html %])[% END %]
343 [% IF mapping.sort == 0 %]
344 <input type="hidden" name="mapping_sort" value="0" readonly />No
346 <input type="hidden" name="mapping_sort" value="1" readonly />Yes
350 <input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %]
353 <input type="hidden" name="mapping_suggestible" value="[% mapping.suggestible | html %]" readonly />[% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %]
356 <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
359 <input type="hidden" name="mapping_filter" value="[% mapping.filter | html %]" readonly />[% IF mapping.filter == 'punctuation' %]Punctuation[% END %]
361 <td data-search="[% mapping.marc_field | html %]">
362 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
369 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
370 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
371 [% mapping.search_field_name | html %]
372 [% IF mapping.search_field_label != mapping.search_field_name %] ([% mapping.search_field_label | html %])[% END %]
375 <select name="mapping_sort">
376 [% IF mapping.sort == 0 %]
377 <option value="0" selected="selected">No</option>
378 <option value="1">Yes</option>
380 <option value="0">No</option>
381 <option value="1" selected="selected">Yes</option>
386 [% IF mapping.is_facetable %]
387 <select name="mapping_facet">
388 [% IF mapping.facet %]
389 <option value="0">No</option>
390 <option value="1" selected="selected">Yes</option>
392 <option value="0" selected="selected">No</option>
393 <option value="1">Yes</option>
397 <input type="hidden" name="mapping_facet" value="0" />
402 <select name="mapping_suggestible">
403 [% IF mapping.suggestible %]
404 <option value="0">No</option>
405 <option value="1" selected="selected">Yes</option>
407 <option value="0" selected="selected">No</option>
408 <option value="1">Yes</option>
413 <select name="mapping_search">
414 [% IF mapping.search %]
415 <option value="0">No</option>
416 <option value="1" selected="selected">Yes</option>
418 <option value="0" selected="selected">No</option>
419 <option value="1">Yes</option>
424 <select name="mapping_filter">
425 [% IF mapping.filter == 'punctuation' %]
426 <option value="">None</option>
427 <option value="punctuation" selected="selected">Punctuation</option>
429 <option value="" selected="selected">None</option>
430 <option value="punctuation">Punctuation</option>
434 <td data-search="[% mapping.marc_field | html %]">
435 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
437 [% IF mapping.search_field_mandatory %]
438 <td><a class="btn btn-default btn-xs delete-mapping mandatory" data-field_name="[% mapping.search_field_name | html %]" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
440 <td><a class="btn btn-default btn-xs delete-mapping" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
447 <tr data-type="mapping">
449 <input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" />
450 <select data-id="mapping_search_field_name">
451 [% FOREACH f IN all_search_fields %]
452 <option value="[% f.name | html %]">[% f.name | html %][% IF f.label != f.name %] ([% f.label | html %])[% END %]</option>
457 <select data-id="mapping_sort">
458 <option value="0">No</option>
459 <option value="1">Yes</option>
463 <select data-id="mapping_facet">
464 <option value="0">No</option>
465 <option value="1">Yes</option>
469 <select data-id="mapping_suggestible">
470 <option value="0">No</option>
471 <option value="1">Yes</option>
475 <select data-id="mapping_search">
476 <option value="0">No</option>
477 <option value="1">Yes</option>
481 <select data-id="mapping_filter">
482 <option value="">None</option>
483 <option value="punctuation">Punctuation</option>
486 <td><input data-id="mapping_marc_field" type="text" /></td>
487 <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
492 [% IF index.index_name == 'biblios' %]
494 <div class="hint">Drag and drop rows to change the order</div>
495 <div id="facet_[% index.index_name | html %]">
496 <table id="facet_[% index.index_name | html %]_table" style="max-width: 50%; margin: 0;">
500 <th class="NoSort">Search field</th>
501 <th class="NoSort">Label</th>
502 <th class="NoSort">Authorized value category</th>
503 <th class="NoSort"> </th>
507 [% FOREACH f IN facetable_fields %]
509 <td>[% loop.count | html %]</td>
510 <td class="drag_handle">
515 [% CASE 'Authors' %]<span>Authors</span>
516 [% CASE 'Item types' %]<span>Item types</span>
517 [% CASE 'Locations' %]<span>Locations</span>
518 [% CASE 'Places' %]<span>Places</span>
519 [% CASE 'Series' %]<span>Series</span>
520 [% CASE 'Topics' %]<span>Topics</span>
521 [% CASE 'Collections' %]<span>Collections</span>
522 [% CASE 'Holding libraries' %]<span>Holding libraries</span>
523 [% CASE 'Home libraries' %]<span>Home libraries</span>
524 [% CASE 'Languages' %]<span>Languages</span>
525 [% CASE %]<span>[% f.label | html %]</span>
527 <input type="hidden" name="facet_name" value="[% f.name | html %]" />
530 <select name="facet_av_cat_[% f.name | html %]">
531 [% FOR av_cat IN authorised_value_categories %]
532 [% IF f.authorised_value_category == av_cat %]
533 <option value="[% av_cat | html %]" selected="selected">[% av_cat | html %]</option>
535 <option value="[% av_cat | html %]">[% av_cat | html %]</option>
541 <a class="btn btn-default btn-xs delete-facet" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a>
547 <tr data-type="facet">
550 <select data-id="facet-search-field">
551 [% FOREACH search_field IN all_search_fields %]
552 <option value="[% search_field.name | html %]" data-label="[% search_field.label | html %]">[% search_field.name | html %]</option>
558 <select data-id="facet-av-cat">
559 [% FOR av_cat IN authorised_value_categories %]
560 [% IF f.authorised_value_category == av_cat %]
561 <option value="[% av_cat | html %]" selected="selected">[% av_cat | html %]</option>
563 <option value="[% av_cat | html %]">[% av_cat | html %]</option>
568 <td><a class="btn btn-default btn-xs add-facet"><i class="fa fa-plus"></i> Add</a></td>
574 [% END # /WRAPPER tab_panel#mapping_{ index.index_name} %]
575 [% END # /FOREACH index %]
576 [% END # /WRAPPER tab_panels %]
577 [% END # /WRAPPER tabs %]
579 <fieldset class="action">
580 <input type="hidden" name="op" value="cud-edit">
581 <button class="btn btn-primary" type="submit"><i class="fa-solid fa-hard-drive" aria-hidden="true"></i> Save</button>
585 <fieldset class="action">
586 <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Reset mappings</button>
591 </div> <!-- /.col-sm-10.col-sm-push-2 -->
593 <div class="col-sm-2 col-sm-pull-10">
595 [% INCLUDE 'admin-menu.inc' %]
597 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
598 </div> <!-- /.row -->
600 [% MACRO jsinclude BLOCK %]
601 [% INCLUDE 'datatables.inc' %]
602 [% Asset.js("lib/datatables/dataTables.rowReorder.min.js") | $raw %]
603 [% Asset.js("js/elasticsearch-mappings.js") | $raw %]
606 [% INCLUDE 'intranet-bottom.inc' %]