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 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'prefs-admin-search.inc' %]
19 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
22 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
25 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
28 <a href="#" aria-current="page">
29 Search engine configuration (Elasticsearch)
35 [% INCLUDE 'blocking_errors.inc' %]
37 <div class="main container-fluid">
39 <div class="col-sm-10 col-sm-push-2">
42 [% FOR m IN messages %]
43 <div class="dialog [% m.type | html %]">
45 [% CASE 'error_on_update' %]
46 [% tx("An error occurred when updating mappings: {message}.", { message = m.message }) | html %]
47 [% CASE 'error_on_delete' %]
48 [% t("An error occurred when deleting the existing mappings. Nothing has been changed!") | $raw %]
49 [% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %]
50 [% CASE 'invalid_field_weight' %]
51 [% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %]
52 [% CASE 'missing_mandatory_fields' %]
53 [% t("You attempted to delete all mappings for a required index, you must leave at least one mapping") | $raw %]
54 [% CASE 'error_on_update_es_mappings' %]
55 [% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %]
56 [% CASE 'reindex_required' %]
57 [% tx("Index '{index}' needs to be reindexed.", { index = m.index }) | html %]
58 [% CASE 'recreate_required' %]
59 [% tx("Index '{index}' needs to be recreated.", { index = m.index }) | html %]
60 [% CASE 'success_on_update' %]
61 [% t("Mappings updated successfully.") | $raw %]
62 [% CASE 'success_on_reset' %]
63 [% t("Mappings have been reset successfully.") | $raw %]
64 [% CASE 'elasticsearch_disabled' %]
65 [% t("Elasticsearch is currently disabled.") | $raw %]
72 <h1>Search engine configuration (Elasticsearch)</h1>
75 <div class="dialog alert">
76 Changes have not been applied. Please check the following values:
78 [% FOREACH e IN errors %]
80 [% IF ( e.type == "malformed_mapping" ) %]
81 <span>The value "[% e.value | html %]" is not supported for mappings</span>
82 [% ELSIF ( e.type == "no_mapping" ) %]
83 <span>There is no mapping for the index [% e.value | html %]</span>
91 [% IF reset_confirm %]
92 <div class="dialog alert">
93 <h3>The current mappings you see on the screen will be erased and replaced by the mappings in the mappings.yaml file.</h3>
95 <input type="hidden" name="op" value="reset_confirmed" />
96 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, reset mappings</button>
100 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not reset mappings</button>
106 <i class="fa fa-exclamation"></i>
107 <strong>Warning:</strong> Any changes to the configuration will only take effect after a full reindex. Until then searching may not work correctly.
109 <p><strong>Weight:</strong> define weight as a positive number. Higher numbers indicate increased relevancy.
110 <strong>Note that fields weighting works only for simple search.</strong></p>
112 <li>Only search fields mapped with biblios can be weighted</li>
113 <li>Search will boost/increase weighted field(s) relevancy</li>
118 <div id="tabs" class="toptabs ui-tabs" style="clear:both">
120 <li><a href="#search_fields">Search fields</a></li>
121 [% FOREACH index IN indexes %]
122 [% SWITCH index.index_name %]
123 [% CASE 'biblios' %]<li><a href="#mapping_biblios">Bibliographic records</a></li>
124 [% CASE 'authorities' %]<li><a href="#mapping_authorities">Authorities</a></li>
128 <div id="search_fields" class="ui-tabs-panel">
129 <table class="search_fields" id="search_fields_table">
137 <th colspan="2">Searchable</th>
140 <th colspan="5" class="NoSort"> </th>
141 <th class="NoSort">Staff interface</th>
142 <th class="NoSort">OPAC</th>
146 [% FOREACH search_field IN all_search_fields %]
148 <td data-order="[% search_field.name | html %]">
149 [% IF search_field.mandatory %]
150 <input type="text" name="search_field_name" value="[% search_field.name | html %]" readonly />
152 <input type="text" name="search_field_name" value="[% search_field.name | html %]" />
156 [% search_field.aliases.join(', ') | html %]
158 <td data-order="[% search_field.label | html %]">
159 [% IF search_field.mandatory %]
160 <input type="text" name="search_field_label" value="[% search_field.label | html %]" readonly />
162 <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
165 <td data-order="[% search_field.type | html %]">
166 [% IF search_field.mandatory %]
167 <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
168 <select name="search_field_type" disabled>
170 <select name="search_field_type">
172 <option value=""></option>
173 [% IF search_field.type == "string" %]
174 <option value="string" selected="selected">String</option>
176 <option value="string">String</option>
178 [% IF search_field.type == "date" %]
179 <option value="date" selected="selected">Date</option>
181 <option value="date">Date</option>
183 [% IF search_field.type == "year" %]
184 <option value="year" selected="selected">Year</option>
186 <option value="year">Year</option>
188 [% IF search_field.type == "number" %]
189 <option value="number" selected="selected">Number</option>
191 <option value="number">Number</option>
193 [% IF search_field.type == "boolean" %]
194 <option value="boolean" selected="selected">Boolean</option>
196 <option value="boolean">Boolean</option>
198 [% IF search_field.type == "sum" %]
199 <option value="sum" selected="selected">Sum</option>
201 <option value="sum">Sum</option>
203 [% IF search_field.type == "isbn" %]
204 <option value="isbn" selected="selected">ISBN</option>
206 <option value="isbn">ISBN</option>
208 [% IF search_field.type == "stdno" %]
209 <option value="stdno" selected="selected">Std. Number</option>
211 <option value="stdno">Std. Number</option>
215 <td data-order="[% search_field.weight | html %]">
216 [% IF search_field.mapped_biblios %]
217 <input type="text" inputmode="numeric" pattern="[0-9]*" name="search_field_weight" value="[% search_field.weight | html %]" />
219 <input type="text" name="search_field_weight" value="">
223 <select name="search_field_staff_client">
224 [% IF search_field.staff_client %]
225 <option value="1" selected="selected">Yes</option>
226 <option value="0">No</option>
228 <option value="1">Yes</option>
229 <option value="0" selected="selected">No</option>
234 <select name="search_field_opac">
235 [% IF search_field.opac %]
236 <option value="1" selected="selected">Yes</option>
237 <option value="0">No</option>
239 <option value="1">Yes</option>
240 <option value="0" selected="selected">No</option>
249 [% FOREACH index IN indexes %]
250 <div id="mapping_[% index.index_name | html %]" class="ui-tabs-panel">
251 <table class="mappings" data-index_name="[% index.index_name | html %]" data-ordering="false" id="mapping_[% index.index_name | html %]_table">
253 <tr class="nodrag nodrop">
254 <th>Search field</th>
264 [% FOREACH mapping IN index.mappings %]
265 [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %]
268 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
269 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
270 [% mapping.search_field_label | html %]
273 [% IF mapping.sort == 0 %]
274 <input type="hidden" name="mapping_sort" value="0" readonly />No
276 <input type="hidden" name="mapping_sort" value="1" readonly />Yes
280 <input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %]
283 <input type="hidden" name="mapping_suggestible" value="[% mapping.suggestible | html %]" readonly />[% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %]
286 <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
289 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
296 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
297 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
298 [% mapping.search_field_label | html %]
301 <select name="mapping_sort">
302 [% IF mapping.sort == 0 %]
303 <option value="0" selected="selected">No</option>
304 <option value="1">Yes</option>
306 <option value="0">No</option>
307 <option value="1" selected="selected">Yes</option>
312 [% IF mapping.is_facetable %]
313 <select name="mapping_facet">
314 [% IF mapping.facet %]
315 <option value="0">No</option>
316 <option value="1" selected="selected">Yes</option>
318 <option value="0" selected="selected">No</option>
319 <option value="1">Yes</option>
323 <input type="hidden" name="mapping_facet" value="0" />
328 <select name="mapping_suggestible">
329 [% IF mapping.suggestible %]
330 <option value="0">No</option>
331 <option value="1" selected="selected">Yes</option>
333 <option value="0" selected="selected">No</option>
334 <option value="1">Yes</option>
339 <select name="mapping_search">
340 [% IF mapping.search %]
341 <option value="0">No</option>
342 <option value="1" selected="selected">Yes</option>
344 <option value="0" selected="selected">No</option>
345 <option value="1">Yes</option>
350 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
352 [% IF mapping.search_field_mandatory %]
353 <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>
355 <td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
362 <tr class="nodrag nodrop">
364 <input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" />
365 <select data-id="mapping_search_field_name">
366 [% FOREACH f IN all_search_fields %]
367 <option value="[% f.name | html %]">[% f.name | html %]</option>
372 <select data-id="mapping_sort">
373 <option value="undef">Undef</option>
374 <option value="0">0</option>
375 <option value="1">1</option>
379 <select data-id="mapping_facet">
380 [% IF mapping.facet %]
381 <option value="0">No</option>
382 <option value="1" selected="selected">Yes</option>
384 <option value="0" selected="selected">No</option>
385 <option value="1">Yes</option>
390 <select data-id="mapping_suggestible">
391 [% IF mapping.suggestible %]
392 <option value="0">No</option>
393 <option value="1" selected="selected">Yes</option>
395 <option value="0" selected="selected">No</option>
396 <option value="1">Yes</option>
401 <select data-id="mapping_search">
402 [% IF mapping.search %]
403 <option value="0">No</option>
404 <option value="1" selected="selected">Yes</option>
406 <option value="0" selected="selected">No</option>
407 <option value="1">Yes</option>
411 <td><input data-id="mapping_marc_field" type="text" /></td>
412 <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
417 [% IF index.index_name == 'biblios' %]
419 <div id="facet_[% index.index_name | html %]" class="ui-tabs-panel">
423 <th>Search field</th>
429 [% FOREACH f IN facetable_fields %]
436 [% CASE 'author' %]Authors
437 [% CASE 'itype' %]Item Types
438 [% CASE 'location' %]Locations
439 [% CASE 'su-geo' %]Places
440 [% CASE 'title-series' %]Series
441 [% CASE 'subject' %]Topics
442 [% CASE 'ccode' %]Collections
443 [% CASE 'holdingbranch' %]Holding libraries
444 [% CASE 'homebranch' %]Home libraries
445 [% CASE 'ln' %]Language
446 [% CASE %][% f | html %]
450 [% IF f.facet_order %]
451 <input type="checkbox" name="display_facet" value="[% f.name | html %]" checked="checked" />
453 <input type="checkbox" name="display_facet" value="[% f.name | html %]" />
465 <fieldset class="action">
466 <button class="btn btn-default" type="submit" name="op" value="edit"><i class="fa fa-hdd-o" aria-hidden="true"></i> Save</button>
467 <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa fa-refresh" aria-hidden="true"></i> Reset mappings</button>
472 </div> <!-- /.col-sm-10.col-sm-push-2 -->
474 <div class="col-sm-2 col-sm-pull-10">
476 [% INCLUDE 'admin-menu.inc' %]
478 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
479 </div> <!-- /.row -->
481 [% MACRO jsinclude BLOCK %]
482 [% INCLUDE 'datatables.inc' %]
483 [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %]
484 [% Asset.js("js/elasticsearch-mappings.js") | $raw %]
487 [% INCLUDE 'intranet-bottom.inc' %]