3 [% PROCESS 'i18n.inc' %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Administration › Search engine configuration (Elasticsearch)</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %]
9 function clean_line( line ) {
10 $(line).find('input[type="text"]').val("");
11 $(line).find('select').find('option:first').attr("selected", "selected");
14 function clone_line( line ) {
15 var new_line = $(line).clone();
16 $(new_line).removeClass("nodrag nodrop");
17 $(new_line).find('td:last-child>a').removeClass("add").addClass("delete").html(_("Delete"));
18 $(new_line).find('[data-id]').each( function() {
19 $(this).attr({ name: $(this).attr('data-id') }).removeAttr('data-id');
21 $(new_line).find("select").each( function() {
22 var attr = $(this).attr('name');
23 var val = $(line).find('[data-id="' + attr + '"]').val();
24 $(this).find('option[value="' + val + '"]').attr("selected", "selected");
29 $(document).ready(function() {
31 $('.delete').click(function() {
32 if( $(this).hasClass('mandatory') && $(".mandatory[data-field_name="+$(this).attr('data-field_name')+"]").length < 2 ){
33 alert("This field is mandatory and must have at least one mapping");
36 $(this).parents('tr').remove();
40 $("table.mappings").tableDnD( {
41 onDragClass: "dragClass",
43 $('.add').click(function() {
44 var table = $(this).closest('table');
45 var index_name = $(table).attr('data-index_name');
46 var line = $(this).closest("tr");
47 var marc_field = $(line).find('input[data-id="mapping_marc_field"]').val();
48 if ( marc_field.length > 0 ) {
49 var new_line = clone_line( line );
50 new_line.appendTo($('table[data-index_name="'+index_name+'"]>tbody'));
51 $('.delete').click(function() {
52 $(this).parents('tr').remove();
57 onDragClass: "dragClass",
61 $("#facet_biblios > table").tableDnD( {
62 onDragClass: "dragClass",
72 <body id="admin_searchengine_mappings" class="admin">
73 [% INCLUDE 'header.inc' %]
74 [% INCLUDE 'prefs-admin-search.inc' %]
76 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Search engine configuration (Elasticsearch)</div>
78 [% INCLUDE 'blocking_errors.inc' %]
80 <div class="main container-fluid">
82 <div class="col-sm-10 col-sm-push-2">
85 [% FOR m IN messages %]
86 <div class="dialog [% m.type | html %]">
88 [% CASE 'error_on_update' %]
89 [% tx("An error occurred when updating mappings: {message}.", { message = m.message }) | html %]
90 [% CASE 'error_on_delete' %]
91 [% t("An error occurred when deleting the existing mappings. Nothing has been changed!") | $raw %]
92 [% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %]
93 [% CASE 'invalid_field_weight' %]
94 [% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %]
95 [% CASE 'missing_mandatory_fields' %]
96 [% t("You attempted to delete all mappings for a required index, you must leave at least one mapping") | $raw %]
97 [% CASE 'error_on_update_es_mappings' %]
98 [% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %]
99 [% CASE 'reindex_required' %]
100 [% tx("Index '{index}' needs to be reindexed.", { index = m.index }) | html %]
101 [% CASE 'recreate_required' %]
102 [% tx("Index '{index}' needs to be recreated.", { index = m.index }) | html %]
103 [% CASE 'success_on_update' %]
104 [% t("Mappings updated successfully.") | $raw %]
105 [% CASE 'success_on_reset' %]
106 [% t("Mappings have been reset successfully.") | $raw %]
107 [% CASE 'elasticsearch_disabled' %]
108 [% t("Elasticsearch is currently disabled.") | $raw %]
115 <h1>Search engine configuration (Elasticsearch)</h1>
116 <div class="dialog message">
117 Warning: Any changes to the configuration will only take effect after a full reindex. Until then searching may not work correctly.
119 <p>Weight: define weight as a positive number. Higher numbers indicate increased relevancy.
120 <strong>Note that fields weighting works only for simple search.</strong></p>
122 <li>only search fields mapped with biblios can be weighted</li>
123 <li>search will boost/increase weighted field(s) relevancy</li>
127 <div class="dialog alert">
128 Changes have not been applied. Please check the following values:
130 [% FOREACH e IN errors %]
132 [% IF ( e.type == "malformed_mapping" ) %]
133 <span>The value "[% e.value | html %]" is not supported for mappings</span>
134 [% ELSIF ( e.type == "no_mapping" ) %]
135 <span>There is no mapping for the index [% e.value | html %]</span>
143 [% IF reset_confirm %]
144 <div class="dialog alert">
145 <h3>The current mappings you see on the screen will be erased and replaced by the mappings in the mappings.yaml file.</h3>
147 <input type="hidden" name="op" value="reset_confirmed" />
148 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, reset mappings</button>
152 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not reset mappings</button>
157 <div id="tabs" class="toptabs" style="clear:both">
159 <li><a href="#search_fields">Search fields</a></li>
160 [% FOREACH index IN indexes %]
161 [% SWITCH index.index_name %]
162 [% CASE 'biblios' %]<li><a href="#mapping_biblios">Bibliographic records</a></li>
163 [% CASE 'authorities' %]<li><a href="#mapping_authorities">Authorities</a></li>
167 <div id="search_fields">
168 <table class="search_fields">
174 <th colspan="2">Searchable</th>
178 <th colspan=3> </th>
179 <th>Staff interface</th>
185 [% FOREACH search_field IN all_search_fields %]
188 [% IF search_field.mandatory %]
189 <input type="text" name="search_field_name" value="[% search_field.name | html %]" readonly />
191 <input type="text" name="search_field_name" value="[% search_field.name | html %]" />
195 [% IF search_field.mandatory %]
196 <input type="text" name="search_field_label" value="[% search_field.label | html %]" readonly />
198 <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
202 [% IF search_field.mandatory %]
203 <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
204 <select name="search_field_type" disabled>
206 <select name="search_field_type">
208 <option value=""></option>
209 [% IF search_field.type == "string" %]
210 <option value="string" selected="selected">String</option>
212 <option value="string">String</option>
214 [% IF search_field.type == "date" %]
215 <option value="date" selected="selected">Date</option>
217 <option value="date">Date</option>
219 [% IF search_field.type == "year" %]
220 <option value="year" selected="selected">Year</option>
222 <option value="year">Year</option>
224 [% IF search_field.type == "number" %]
225 <option value="number" selected="selected">Number</option>
227 <option value="number">Number</option>
229 [% IF search_field.type == "boolean" %]
230 <option value="boolean" selected="selected">Boolean</option>
232 <option value="boolean">Boolean</option>
234 [% IF search_field.type == "sum" %]
235 <option value="sum" selected="selected">Sum</option>
237 <option value="sum">Sum</option>
239 [% IF search_field.type == "isbn" %]
240 <option value="isbn" selected="selected">ISBN</option>
242 <option value="isbn">ISBN</option>
244 [% IF search_field.type == "stdno" %]
245 <option value="stdno" selected="selected">Std. Number</option>
247 <option value="stdno">Std. Number</option>
252 <select name="search_field_staff_client">
253 [% IF search_field.staff_client %]
254 <option value="1" selected="selected">Yes</option>
255 <option value="0">No</option>
257 <option value="1">Yes</option>
258 <option value="0" selected="selected">No</option>
263 <select name="search_field_opac">
264 [% IF search_field.opac %]
265 <option value="1" selected="selected">Yes</option>
266 <option value="0">No</option>
268 <option value="1">Yes</option>
269 <option value="0" selected="selected">No</option>
274 [% IF search_field.mapped_biblios %]
275 <input type="number" step="0.01" min="0.01" max="999.99" name="search_field_weight" value="[% search_field.weight | html %]" />
277 <input type="hidden" name="search_field_weight" value="">
285 [% FOREACH index IN indexes %]
286 <div id="mapping_[% index.index_name | html %]">
287 <table class="mappings" data-index_name="[% index.index_name | html %]">
289 <tr class="nodrag nodrop">
290 <th>Search field</th>
300 [% FOREACH mapping IN index.mappings %]
301 [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %]
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_label | html %]
309 <input type="hidden" name="mapping_sort" value="[% mapping.sort | html %]" readonly />[% IF mapping.sort == 'undef' %]Undef[% ELSE %][% mapping.sort | html %][% END %]
312 <input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %]
315 <input type="hidden" name="mapping_suggestible" value="[% mapping.suggestible | html %]" readonly />[% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %]
318 <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
321 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
327 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
328 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
329 [% mapping.search_field_label | html %]
332 <select name="mapping_sort">
333 [% IF mapping.sort == 'undef' %]
334 <option value="undef" selected="selected">Undef</option>
336 <option value="undef">Undef</option>
338 [% IF mapping.sort == 0 %]
339 <option value="0" selected="selected">0</option>
341 <option value="0">0</option>
343 [% IF mapping.sort == 1 %]
344 <option value="1" selected="selected">1</option>
346 <option value="1">1</option>
351 [% IF mapping.is_facetable %]
352 <select name="mapping_facet">
353 [% IF mapping.facet %]
354 <option value="0">No</option>
355 <option value="1" selected="selected">Yes</option>
357 <option value="0" selected="selected">No</option>
358 <option value="1">Yes</option>
362 <input type="hidden" name="mapping_facet" value="0" />
367 <select name="mapping_suggestible">
368 [% IF mapping.suggestible %]
369 <option value="0">No</option>
370 <option value="1" selected="selected">Yes</option>
372 <option value="0" selected="selected">No</option>
373 <option value="1">Yes</option>
378 <select name="mapping_search">
379 [% IF mapping.search %]
380 <option value="0">No</option>
381 <option value="1" selected="selected">Yes</option>
383 <option value="0" selected="selected">No</option>
384 <option value="1">Yes</option>
389 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
391 [% IF mapping.search_field_mandatory %]
392 <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>
394 <td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
401 <tr class="nodrag nodrop">
403 <input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" />
404 <select data-id="mapping_search_field_name">
405 [% FOREACH f IN all_search_fields %]
406 <option value="[% f.name | html %]">[% f.name | html %]</option>
411 <select data-id="mapping_sort">
412 <option value="undef">Undef</option>
413 <option value="0">0</option>
414 <option value="1">1</option>
418 <select data-id="mapping_facet">
419 [% IF mapping.facet %]
420 <option value="0">No</option>
421 <option value="1" selected="selected">Yes</option>
423 <option value="0" selected="selected">No</option>
424 <option value="1">Yes</option>
429 <select data-id="mapping_suggestible">
430 [% IF mapping.suggestible %]
431 <option value="0">No</option>
432 <option value="1" selected="selected">Yes</option>
434 <option value="0" selected="selected">No</option>
435 <option value="1">Yes</option>
440 <select data-id="mapping_search">
441 [% IF mapping.search %]
442 <option value="0">No</option>
443 <option value="1" selected="selected">Yes</option>
445 <option value="0" selected="selected">No</option>
446 <option value="1">Yes</option>
450 <td><input data-id="mapping_marc_field" type="text" /></td>
451 <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
456 [% IF index.index_name == 'biblios' %]
458 <div id="facet_[% index.index_name | html %]">
462 <th>Search field</th>
468 [% FOREACH f IN facetable_fields %]
475 [% CASE 'author' %]Authors
476 [% CASE 'itype' %]Item Types
477 [% CASE 'location' %]Locations
478 [% CASE 'su-geo' %]Places
479 [% CASE 'title-series' %]Series
480 [% CASE 'subject' %]Topics
481 [% CASE 'ccode' %]Collections
482 [% CASE 'holdingbranch' %]Holding libraries
483 [% CASE 'homebranch' %]Home libraries
484 [% CASE 'ln' %]Language
485 [% CASE %][% f | html %]
489 [% IF f.facet_order %]
490 <input type="checkbox" name="display_facet" value="[% f.name | html %]" checked="checked" />
492 <input type="checkbox" name="display_facet" value="[% f.name | html %]" />
505 <button class="btn btn-default" type="submit" name="op" value="edit"><i class="fa fa-hdd-o" aria-hidden="true"></i> Save</button>
506 <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa fa-refresh" aria-hidden="true"></i> Reset Mappings</button>
511 </div> <!-- /.col-sm-10.col-sm-push-2 -->
513 <div class="col-sm-2 col-sm-pull-10">
515 [% INCLUDE 'admin-menu.inc' %]
517 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
518 </div> <!-- /.row -->
520 [% INCLUDE 'intranet-bottom.inc' %]