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 $(this).parents('tr').remove();
35 $("table.mappings").tableDnD( {
36 onDragClass: "dragClass",
38 $('.add').click(function() {
39 var table = $(this).closest('table');
40 var index_name = $(table).attr('data-index_name');
41 var line = $(this).closest("tr");
42 var marc_field = $(line).find('input[data-id="mapping_marc_field"]').val();
43 if ( marc_field.length > 0 ) {
44 var new_line = clone_line( line );
45 new_line.appendTo($('table[data-index_name="'+index_name+'"]>tbody'));
46 $('.delete').click(function() {
47 $(this).parents('tr').remove();
52 onDragClass: "dragClass",
56 $("#facet_biblios > table").tableDnD( {
57 onDragClass: "dragClass",
67 <body id="admin_searchengine_mappings" class="admin">
68 [% INCLUDE 'header.inc' %]
69 [% INCLUDE 'prefs-admin-search.inc' %]
71 <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>
73 [% INCLUDE 'blocking_errors.inc' %]
75 <div class="main container-fluid">
77 <div class="col-sm-10 col-sm-push-2">
80 [% FOR m IN messages %]
81 <div class="dialog [% m.type | html %]">
83 [% CASE 'error_on_update' %]
84 [% tx("An error occurred when updating mappings: {message}.", { message = m.message }) | html %]
85 [% CASE 'error_on_delete' %]
86 [% t("An error occurred when deleting the existing mappings. Nothing has been changed!") | $raw %]
87 [% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %]
88 [% CASE 'invalid_field_weight' %]
89 [% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %]
90 [% CASE 'error_on_update_es_mappings' %]
91 [% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %]
92 [% CASE 'reindex_required' %]
93 [% tx("Index '{index}' needs to be reindexed.", { index = m.index }) | html %]
94 [% CASE 'recreate_required' %]
95 [% tx("Index '{index}' needs to be recreated.", { index = m.index }) | html %]
96 [% CASE 'success_on_update' %]
97 [% t("Mappings updated successfully.") | $raw %]
98 [% CASE 'success_on_reset' %]
99 [% t("Mappings have been reset successfully.") | $raw %]
100 [% CASE 'elasticsearch_disabled' %]
101 [% t("Elasticsearch is currently disabled.") | $raw %]
108 <h1>Search engine configuration (Elasticsearch)</h1>
109 <div class="dialog message">
110 Warning: Any changes to the configuration will only take effect after a full reindex. Until then searching may not work correctly.
112 <p>Weight: define weight as a positive number. Higher numbers indicate increased relevancy.
113 <strong>Note that fields weighting works only for simple search.</strong></p>
115 <li>only search fields mapped with biblios can be weighted</li>
116 <li>search will boost/increase weighted field(s) relevancy</li>
120 <div class="dialog alert">
121 Changes have not been applied. Please check the following values:
123 [% FOREACH e IN errors %]
125 [% IF ( e.type == "malformed_mapping" ) %]
126 <span>The value "[% e.value | html %]" is not supported for mappings</span>
127 [% ELSIF ( e.type == "no_mapping" ) %]
128 <span>There is no mapping for the index [% e.value | html %]</span>
136 [% IF reset_confirm %]
137 <div class="dialog alert">
138 <h3>The current mappings you see on the screen will be erased and replaced by the mappings in the mappings.yaml file.</h3>
140 <input type="hidden" name="op" value="reset_confirmed" />
141 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, reset mappings</button>
145 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not reset mappings</button>
150 <div id="tabs" class="toptabs" style="clear:both">
152 <li><a href="#search_fields">Search fields</a></li>
153 [% FOREACH index IN indexes %]
154 [% SWITCH index.index_name %]
155 [% CASE 'biblios' %]<li><a href="#mapping_biblios">Bibliographic records</a></li>
156 [% CASE 'authorities' %]<li><a href="#mapping_authorities">Authorities</a></li>
160 <div id="search_fields">
161 <table class="search_fields">
167 <th colspan="2">Searchable</th>
171 <th colspan=3> </th>
172 <th>Staff client</th>
178 [% FOREACH search_field IN all_search_fields %]
181 <input type="text" name="search_field_name" value="[% search_field.name | html %]" />
184 <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
187 <select name="search_field_type">
188 <option value=""></option>
189 [% IF search_field.type == "string" %]
190 <option value="string" selected="selected">String</option>
192 <option value="string">String</option>
194 [% IF search_field.type == "date" %]
195 <option value="date" selected="selected">Date</option>
197 <option value="date">Date</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>
227 <select name="search_field_staff_client">
228 [% IF search_field.staff_client %]
229 <option value="1" selected="selected">Yes</option>
230 <option value="0">No</option>
232 <option value="1">Yes</option>
233 <option value="0" selected="selected">No</option>
238 <select name="search_field_opac">
239 [% IF search_field.opac %]
240 <option value="1" selected="selected">Yes</option>
241 <option value="0">No</option>
243 <option value="1">Yes</option>
244 <option value="0" selected="selected">No</option>
249 [% IF search_field.mapped_biblios %]
250 <input type="number" step="0.01" min="0.01" max="999.99" name="search_field_weight" value="[% search_field.weight | html %]" />
252 <input type="hidden" name="search_field_weight" value="">
260 [% FOREACH index IN indexes %]
261 <div id="mapping_[% index.index_name | html %]">
262 <table class="mappings" data-index_name="[% index.index_name | html %]">
264 <tr class="nodrag nodrop">
265 <th>Search field</th>
275 [% FOREACH mapping IN index.mappings %]
278 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
279 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
280 [% mapping.search_field_label | html %]
283 <select name="mapping_sort">
284 [% IF mapping.sort == 'undef' %]
285 <option value="undef" selected="selected">Undef</option>
287 <option value="undef">Undef</option>
289 [% IF mapping.sort == 0 %]
290 <option value="0" selected="selected">0</option>
292 <option value="0">0</option>
294 [% IF mapping.sort == 1 %]
295 <option value="1" selected="selected">1</option>
297 <option value="1">1</option>
302 [% IF mapping.is_facetable %]
303 <select name="mapping_facet">
304 [% IF mapping.facet %]
305 <option value="0">No</option>
306 <option value="1" selected="selected">Yes</option>
308 <option value="0" selected="selected">No</option>
309 <option value="1">Yes</option>
313 <input type="hidden" name="mapping_facet" value="0" />
318 <select name="mapping_suggestible">
319 [% IF mapping.suggestible %]
320 <option value="0">No</option>
321 <option value="1" selected="selected">Yes</option>
323 <option value="0" selected="selected">No</option>
324 <option value="1">Yes</option>
329 <select name="mapping_search">
330 [% IF mapping.search %]
331 <option value="0">No</option>
332 <option value="1" selected="selected">Yes</option>
334 <option value="0" selected="selected">No</option>
335 <option value="1">Yes</option>
340 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
342 <td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
347 <tr class="nodrag nodrop">
349 <input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" />
350 <select data-id="mapping_search_field_name">
351 [% FOREACH f IN all_search_fields %]
352 <option value="[% f.name | html %]">[% f.name | html %]</option>
357 <select data-id="mapping_sort">
358 <option value="undef">Undef</option>
359 <option value="0">0</option>
360 <option value="1">1</option>
364 <select data-id="mapping_facet">
365 [% IF mapping.facet %]
366 <option value="0">No</option>
367 <option value="1" selected="selected">Yes</option>
369 <option value="0" selected="selected">No</option>
370 <option value="1">Yes</option>
375 <select data-id="mapping_suggestible">
376 [% IF mapping.suggestible %]
377 <option value="0">No</option>
378 <option value="1" selected="selected">Yes</option>
380 <option value="0" selected="selected">No</option>
381 <option value="1">Yes</option>
386 <select data-id="mapping_search">
387 [% IF mapping.search %]
388 <option value="0">No</option>
389 <option value="1" selected="selected">Yes</option>
391 <option value="0" selected="selected">No</option>
392 <option value="1">Yes</option>
396 <td><input data-id="mapping_marc_field" type="text" /></td>
397 <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
402 [% IF index.index_name == 'biblios' %]
404 <div id="facet_[% index.index_name | html %]">
408 <th>Search field</th>
414 [% FOREACH f IN facetable_fields %]
421 [% CASE 'author' %]Authors
422 [% CASE 'itype' %]Item Types
423 [% CASE 'location' %]Locations
424 [% CASE 'su-geo' %]Places
425 [% CASE 'title-series' %]Series
426 [% CASE 'subject' %]Topics
427 [% CASE 'ccode' %]Collections
428 [% CASE 'holdingbranch' %]Holding libraries
429 [% CASE 'homebranch' %]Home libraries
430 [% CASE 'ln' %]Language
431 [% CASE %][% f | html %]
435 [% IF f.facet_order %]
436 <input type="checkbox" name="display_facet" value="[% f.name | html %]" checked="checked" />
438 <input type="checkbox" name="display_facet" value="[% f.name | html %]" />
451 <button class="btn btn-default" type="submit" name="op" value="edit"><i class="fa fa-hdd-o" aria-hidden="true"></i> Save</button>
452 <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa fa-refresh" aria-hidden="true"></i> Reset Mappings</button>
457 </div> <!-- /.col-sm-10.col-sm-push-2 -->
459 <div class="col-sm-2 col-sm-pull-10">
461 [% INCLUDE 'admin-menu.inc' %]
463 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
464 </div> <!-- /.row -->
466 [% INCLUDE 'intranet-bottom.inc' %]