4 [% PROCESS 'i18n.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Search engine configuration (Elasticsearch) › Administration › Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
15 <body id="admin_searchengine_mappings" class="admin">
16 [% WRAPPER 'header.inc' %]
17 [% INCLUDE 'prefs-admin-search.inc' %]
20 [% WRAPPER 'sub-header.inc' %]
21 [% WRAPPER breadcrumbs %]
22 [% WRAPPER breadcrumb_item %]
23 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
25 [% WRAPPER breadcrumb_item bc_active= 1 %]
26 <span>Search engine configuration (Elasticsearch)</span>
28 [% END #/ WRAPPER breadcrumbs %]
29 [% END #/ WRAPPER sub-header.inc %]
31 [% INCLUDE 'blocking_errors.inc' %]
33 <div class="main container-fluid">
35 <div class="col-sm-10 col-sm-push-2">
38 [% FOR m IN messages %]
39 <div class="dialog [% m.type | html %]">
41 [% CASE 'error_on_update' %]
42 [% tx("An error occurred when updating mappings: {message}.", { message = m.message }) | html %]
43 [% CASE 'error_on_delete' %]
44 [% t("An error occurred when deleting the existing mappings. Nothing has been changed!") | $raw %]
45 [% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %]
46 [% CASE 'invalid_field_weight' %]
47 [% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %]
48 [% CASE 'missing_mandatory_fields' %]
49 [% t("You attempted to delete all mappings for a required index, you must leave at least one mapping") | $raw %]
50 [% CASE 'error_on_update_es_mappings' %]
51 [% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %]
52 [% CASE 'reindex_required' %]
53 [% tx("Index '{index}' needs to be reindexed.", { index = m.index }) | html %]
54 [% CASE 'recreate_required' %]
55 [% tx("Index '{index}' needs to be recreated.", { index = m.index }) | html %]
56 [% CASE 'success_on_update' %]
57 [% t("Mappings updated successfully.") | $raw %]
58 [% CASE 'success_on_reset' %]
59 [% t("Mappings have been reset successfully.") | $raw %]
60 [% CASE 'elasticsearch_disabled' %]
61 [% t("Elasticsearch is currently disabled.") | $raw %]
68 <h1>Search engine configuration (Elasticsearch)</h1>
71 <div class="dialog alert">
72 Changes have not been applied. Please check the following values:
74 [% FOREACH e IN errors %]
76 [% IF ( e.type == "malformed_mapping" ) %]
77 <span>The value "[% e.value | html %]" is not supported for mappings</span>
78 [% ELSIF ( e.type == "no_mapping" ) %]
79 <span>There is no mapping for the index [% e.value | html %]</span>
87 [% IF reset_confirm %]
88 <div class="dialog alert">
89 <h3>The current mappings you see on the screen will be erased and replaced by the mappings in the mappings.yaml file.</h3>
91 <input type="hidden" name="op" value="reset_confirmed" />
92 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, reset mappings</button>
96 <button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not reset mappings</button>
102 <i class="fa fa-exclamation"></i>
103 <strong>Warning:</strong> Any changes to the configuration will only take effect after a full reindex. Until then searching may not work correctly.
105 <p><strong>Weight:</strong> define weight as a positive number. Higher numbers indicate increased relevancy.
106 <strong>Note that fields weighting works only for simple search.</strong></p>
108 <li>Only search fields mapped with biblios can be weighted</li>
109 <li>Search will boost/increase weighted field(s) relevancy</li>
113 <form id="es_mappings" method="post">
115 [% WRAPPER tabs id= "tabs" %]
117 [% WRAPPER tabs_nav %]
118 [% WRAPPER tab_item tabname= "search_fields" bt_active= 1 %] Search fields [% END %]
119 [% FOREACH index IN indexes %]
120 [% SWITCH index.index_name %]
122 [% WRAPPER tab_item tabname= "mapping_biblios" %] <span>Bibliographic records</span> [% END %]
123 [% CASE 'authorities' %]
124 [% WRAPPER tab_item tabname= "mapping_authorities" %] <span>Authorities</span> [% END %]
127 [% END # /WRAPPER tabs_nav %]
129 [% WRAPPER tab_panels %]
130 [% WRAPPER tab_panel tabname="search_fields" bt_active= 1 %]
131 <table class="search_fields" id="search_fields_table">
139 <th colspan="2">Searchable</th>
142 <th colspan="5" class="NoSort"> </th>
143 <th class="NoSort">Staff interface</th>
144 <th class="NoSort">OPAC</th>
148 [% FOREACH search_field IN all_search_fields %]
150 <td data-order="[% search_field.name | html %]">
151 [% IF search_field.mandatory %]
152 <input type="text" name="search_field_name" value="[% search_field.name | html %]" readonly />
154 <input type="text" name="search_field_name" value="[% search_field.name | html %]" />
158 [% search_field.aliases.join(', ') | html %]
160 <td data-order="[% search_field.label | html %]">
161 [% IF search_field.mandatory %]
162 <input type="text" name="search_field_label" value="[% search_field.label | html %]" readonly />
164 <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
167 <td data-order="[% search_field.type | html %]">
168 [% IF search_field.mandatory %]
169 <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
170 <select name="search_field_type" disabled>
172 <select name="search_field_type">
174 <option value=""></option>
175 [% IF search_field.type == "string" %]
176 <option value="string" selected="selected">String</option>
178 <option value="string">String</option>
180 [% IF search_field.type == "date" %]
181 <option value="date" selected="selected">Date</option>
183 <option value="date">Date</option>
185 [% IF search_field.type == "year" %]
186 <option value="year" selected="selected">Year</option>
188 <option value="year">Year</option>
190 [% IF search_field.type == "number" %]
191 <option value="number" selected="selected">Number</option>
193 <option value="number">Number</option>
195 [% IF search_field.type == "boolean" %]
196 <option value="boolean" selected="selected">Boolean</option>
198 <option value="boolean">Boolean</option>
200 [% IF search_field.type == "sum" %]
201 <option value="sum" selected="selected">Sum</option>
203 <option value="sum">Sum</option>
205 [% IF search_field.type == "isbn" %]
206 <option value="isbn" selected="selected">ISBN</option>
208 <option value="isbn">ISBN</option>
210 [% IF search_field.type == "stdno" %]
211 <option value="stdno" selected="selected">Std. Number</option>
213 <option value="stdno">Std. Number</option>
215 [% IF search_field.type == "callnumber" %]
216 <option value="callnumber" selected="selected">Call Number</option>
218 <option value="callnumber">Call Number</option>
222 <td data-order="[% search_field.weight | html %]">
223 [% IF search_field.mapped_biblios %]
224 <input type="text" inputmode="decimal" pattern="[0-9\.]*" name="search_field_weight" value="[% search_field.weight | html %]" />
226 <input type="text" name="search_field_weight" value="">
230 <select name="search_field_staff_client">
231 [% IF search_field.staff_client %]
232 <option value="1" selected="selected">Yes</option>
233 <option value="0">No</option>
235 <option value="1">Yes</option>
236 <option value="0" selected="selected">No</option>
241 <select name="search_field_opac">
242 [% IF search_field.opac %]
243 <option value="1" selected="selected">Yes</option>
244 <option value="0">No</option>
246 <option value="1">Yes</option>
247 <option value="0" selected="selected">No</option>
256 [% FOREACH index IN indexes %]
257 [% WRAPPER tab_panel tabname="mapping_${ index.index_name }" %]
258 <table class="mappings" data-index_name="[% index.index_name | html %]" data-ordering="false" id="mapping_[% index.index_name | html %]_table">
260 <tr class="nodrag nodrop">
261 <th>Search field</th>
271 [% FOREACH mapping IN index.mappings %]
272 [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %]
275 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
276 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
277 [% mapping.search_field_name | html %]
278 [% IF mapping.search_field_label != mapping.search_field_name %] ([% mapping.search_field_label | html %])[% END %]
281 [% IF mapping.sort == 0 %]
282 <input type="hidden" name="mapping_sort" value="0" readonly />No
284 <input type="hidden" name="mapping_sort" value="1" readonly />Yes
288 <input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %]
291 <input type="hidden" name="mapping_suggestible" value="[% mapping.suggestible | html %]" readonly />[% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %]
294 <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
296 <td data-search="[% mapping.marc_field | html %]">
297 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
304 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
305 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
306 [% mapping.search_field_name | html %]
307 [% IF mapping.search_field_label != mapping.search_field_name %] ([% mapping.search_field_label | html %])[% END %]
310 <select name="mapping_sort">
311 [% IF mapping.sort == 0 %]
312 <option value="0" selected="selected">No</option>
313 <option value="1">Yes</option>
315 <option value="0">No</option>
316 <option value="1" selected="selected">Yes</option>
321 [% IF mapping.is_facetable %]
322 <select name="mapping_facet">
323 [% IF mapping.facet %]
324 <option value="0">No</option>
325 <option value="1" selected="selected">Yes</option>
327 <option value="0" selected="selected">No</option>
328 <option value="1">Yes</option>
332 <input type="hidden" name="mapping_facet" value="0" />
337 <select name="mapping_suggestible">
338 [% IF mapping.suggestible %]
339 <option value="0">No</option>
340 <option value="1" selected="selected">Yes</option>
342 <option value="0" selected="selected">No</option>
343 <option value="1">Yes</option>
348 <select name="mapping_search">
349 [% IF mapping.search %]
350 <option value="0">No</option>
351 <option value="1" selected="selected">Yes</option>
353 <option value="0" selected="selected">No</option>
354 <option value="1">Yes</option>
358 <td data-search="[% mapping.marc_field | html %]">
359 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
361 [% IF mapping.search_field_mandatory %]
362 <td><a class="btn btn-default btn-xs delete mandatory" data-field_name="[% mapping.search_field_name | html %]" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
364 <td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
371 <tr class="nodrag nodrop">
373 <input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" />
374 <select data-id="mapping_search_field_name">
375 [% FOREACH f IN all_search_fields %]
376 <option value="[% f.name | html %]">[% f.name | html %][% IF f.label != f.name %] ([% f.label | html %])[% END %]</option>
381 <select data-id="mapping_sort">
382 <option value="undef">Undef</option>
383 <option value="0">0</option>
384 <option value="1">1</option>
388 <select data-id="mapping_facet">
389 [% IF mapping.facet %]
390 <option value="0">No</option>
391 <option value="1" selected="selected">Yes</option>
393 <option value="0" selected="selected">No</option>
394 <option value="1">Yes</option>
399 <select data-id="mapping_suggestible">
400 [% IF mapping.suggestible %]
401 <option value="0">No</option>
402 <option value="1" selected="selected">Yes</option>
404 <option value="0" selected="selected">No</option>
405 <option value="1">Yes</option>
410 <select data-id="mapping_search">
411 [% IF mapping.search %]
412 <option value="0">No</option>
413 <option value="1" selected="selected">Yes</option>
415 <option value="0" selected="selected">No</option>
416 <option value="1">Yes</option>
420 <td><input data-id="mapping_marc_field" type="text" /></td>
421 <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
426 [% IF index.index_name == 'biblios' %]
428 <div id="facet_[% index.index_name | html %]" class="ui-tabs-panel">
432 <th>Search field</th>
438 [% FOREACH f IN facetable_fields %]
445 [% CASE 'author' %]<span>Authors</span>
446 [% CASE 'itype' %]<span>Item types</span>
447 [% CASE 'location' %]<span>Locations</span>
448 [% CASE 'su-geo' %]<span>Places</span>
449 [% CASE 'title-series' %]<span>Series</span>
450 [% CASE 'subject' %]<span>Topics</span>
451 [% CASE 'ccode' %]<span>Collections</span>
452 [% CASE 'holdingbranch' %]<span>Holding libraries</span>
453 [% CASE 'homebranch' %]<span>Home libraries</span>
454 [% CASE 'ln' %]<span>Language</span>
455 [% CASE %][% f | html %]
459 [% IF f.facet_order %]
460 <input type="checkbox" name="display_facet" value="[% f.name | html %]" checked="checked" />
462 <input type="checkbox" name="display_facet" value="[% f.name | html %]" />
471 [% END # /WRAPPER tab_panel#mapping_{ index.index_name} %]
472 [% END # /FOREACH index %]
473 [% END # /WRAPPER tab_panels %]
474 [% END # /WRAPPER tabs %]
476 <fieldset class="action">
477 <button class="btn btn-primary" type="submit" name="op" value="edit"><i class="fa-solid fa-hard-drive" aria-hidden="true"></i> Save</button>
478 <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>
483 </div> <!-- /.col-sm-10.col-sm-push-2 -->
485 <div class="col-sm-2 col-sm-pull-10">
487 [% INCLUDE 'admin-menu.inc' %]
489 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
490 </div> <!-- /.row -->
492 [% MACRO jsinclude BLOCK %]
493 [% INCLUDE 'datatables.inc' %]
494 [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %]
495 [% Asset.js("js/elasticsearch-mappings.js") | $raw %]
498 [% INCLUDE 'intranet-bottom.inc' %]