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 %]
186 [% IF search_field.mandatory %]
187 [% SET is_readonly = "readonly" %]
189 [% SET is_readonly = "" %]
193 <input type="text" name="search_field_name" value="[% search_field.name | html %]" [% is_readonly %]/>
196 <input type="text" name="search_field_label" value="[% search_field.label | html %]" [% is_readonly %]/>
199 <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
200 <select name="search_field_type" disabled>
202 <select name="search_field_type">
204 <option value=""></option>
205 [% IF search_field.type == "string" %]
206 <option value="string" selected="selected">String</option>
208 <option value="string">String</option>
210 [% IF search_field.type == "date" %]
211 <option value="date" selected="selected">Date</option>
213 <option value="date">Date</option>
215 [% IF search_field.type == "year" %]
216 <option value="year" selected="selected">Year</option>
218 <option value="year">Year</option>
220 [% IF search_field.type == "number" %]
221 <option value="number" selected="selected">Number</option>
223 <option value="number">Number</option>
225 [% IF search_field.type == "boolean" %]
226 <option value="boolean" selected="selected">Boolean</option>
228 <option value="boolean">Boolean</option>
230 [% IF search_field.type == "sum" %]
231 <option value="sum" selected="selected">Sum</option>
233 <option value="sum">Sum</option>
235 [% IF search_field.type == "isbn" %]
236 <option value="isbn" selected="selected">ISBN</option>
238 <option value="isbn">ISBN</option>
240 [% IF search_field.type == "stdno" %]
241 <option value="stdno" selected="selected">Std. Number</option>
243 <option value="stdno">Std. Number</option>
248 <select name="search_field_staff_client">
249 [% IF search_field.staff_client %]
250 <option value="1" selected="selected">Yes</option>
251 <option value="0">No</option>
253 <option value="1">Yes</option>
254 <option value="0" selected="selected">No</option>
259 <select name="search_field_opac">
260 [% IF search_field.opac %]
261 <option value="1" selected="selected">Yes</option>
262 <option value="0">No</option>
264 <option value="1">Yes</option>
265 <option value="0" selected="selected">No</option>
270 [% IF search_field.mapped_biblios %]
271 <input type="number" step="0.01" min="0.01" max="999.99" name="search_field_weight" value="[% search_field.weight | html %]" />
273 <input type="hidden" name="search_field_weight" value="">
281 [% FOREACH index IN indexes %]
282 <div id="mapping_[% index.index_name | html %]">
283 <table class="mappings" data-index_name="[% index.index_name | html %]">
285 <tr class="nodrag nodrop">
286 <th>Search field</th>
296 [% FOREACH mapping IN index.mappings %]
297 [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %]
300 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
301 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
302 [% mapping.search_field_label | html %]
305 <input type="hidden" name="mapping_sort" value="[% mapping.sort | html %]" readonly />[% IF mapping.sort == 'undef' %]Undef[% ELSE %][% mapping.sort | html %][% END %]
308 <input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %]
311 <input type="hidden" name="mapping_suggestible" value="[% mapping.suggestible | html %]" readonly />[% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %]
314 <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
317 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
323 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
324 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
325 [% mapping.search_field_label | html %]
328 <select name="mapping_sort">
329 [% IF mapping.sort == 'undef' %]
330 <option value="undef" selected="selected">Undef</option>
332 <option value="undef">Undef</option>
334 [% IF mapping.sort == 0 %]
335 <option value="0" selected="selected">0</option>
337 <option value="0">0</option>
339 [% IF mapping.sort == 1 %]
340 <option value="1" selected="selected">1</option>
342 <option value="1">1</option>
347 [% IF mapping.is_facetable %]
348 <select name="mapping_facet">
349 [% IF mapping.facet %]
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 <input type="hidden" name="mapping_facet" value="0" />
363 <select name="mapping_suggestible">
364 [% IF mapping.suggestible %]
365 <option value="0">No</option>
366 <option value="1" selected="selected">Yes</option>
368 <option value="0" selected="selected">No</option>
369 <option value="1">Yes</option>
374 <select name="mapping_search">
375 [% IF mapping.search %]
376 <option value="0">No</option>
377 <option value="1" selected="selected">Yes</option>
379 <option value="0" selected="selected">No</option>
380 <option value="1">Yes</option>
385 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
387 [% IF mapping.search_field_mandatory %]
388 <td><a class="btn btn-default btn-xs delete mandatory" data-field_name="[% mapping.search_field_name %]" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
390 <td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
397 <tr class="nodrag nodrop">
399 <input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" />
400 <select data-id="mapping_search_field_name">
401 [% FOREACH f IN all_search_fields %]
402 <option value="[% f.name | html %]">[% f.name | html %]</option>
407 <select data-id="mapping_sort">
408 <option value="undef">Undef</option>
409 <option value="0">0</option>
410 <option value="1">1</option>
414 <select data-id="mapping_facet">
415 [% IF mapping.facet %]
416 <option value="0">No</option>
417 <option value="1" selected="selected">Yes</option>
419 <option value="0" selected="selected">No</option>
420 <option value="1">Yes</option>
425 <select data-id="mapping_suggestible">
426 [% IF mapping.suggestible %]
427 <option value="0">No</option>
428 <option value="1" selected="selected">Yes</option>
430 <option value="0" selected="selected">No</option>
431 <option value="1">Yes</option>
436 <select data-id="mapping_search">
437 [% IF mapping.search %]
438 <option value="0">No</option>
439 <option value="1" selected="selected">Yes</option>
441 <option value="0" selected="selected">No</option>
442 <option value="1">Yes</option>
446 <td><input data-id="mapping_marc_field" type="text" /></td>
447 <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
452 [% IF index.index_name == 'biblios' %]
454 <div id="facet_[% index.index_name | html %]">
458 <th>Search field</th>
464 [% FOREACH f IN facetable_fields %]
471 [% CASE 'author' %]Authors
472 [% CASE 'itype' %]Item Types
473 [% CASE 'location' %]Locations
474 [% CASE 'su-geo' %]Places
475 [% CASE 'title-series' %]Series
476 [% CASE 'subject' %]Topics
477 [% CASE 'ccode' %]Collections
478 [% CASE 'holdingbranch' %]Holding libraries
479 [% CASE 'homebranch' %]Home libraries
480 [% CASE 'ln' %]Language
481 [% CASE %][% f | html %]
485 [% IF f.facet_order %]
486 <input type="checkbox" name="display_facet" value="[% f.name | html %]" checked="checked" />
488 <input type="checkbox" name="display_facet" value="[% f.name | html %]" />
501 <button class="btn btn-default" type="submit" name="op" value="edit"><i class="fa fa-hdd-o" aria-hidden="true"></i> Save</button>
502 <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa fa-refresh" aria-hidden="true"></i> Reset Mappings</button>
507 </div> <!-- /.col-sm-10.col-sm-push-2 -->
509 <div class="col-sm-2 col-sm-pull-10">
511 [% INCLUDE 'admin-menu.inc' %]
513 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
514 </div> <!-- /.row -->
516 [% INCLUDE 'intranet-bottom.inc' %]