4 [% PROCESS 'i18n.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Administration › Search engine configuration (Elasticsearch)</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 <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>
21 [% INCLUDE 'blocking_errors.inc' %]
23 <div class="main container-fluid">
25 <div class="col-sm-10 col-sm-push-2">
28 [% FOR m IN messages %]
29 <div class="dialog [% m.type | html %]">
31 [% CASE 'error_on_update' %]
32 [% tx("An error occurred when updating mappings: {message}.", { message = m.message }) | html %]
33 [% CASE 'error_on_delete' %]
34 [% t("An error occurred when deleting the existing mappings. Nothing has been changed!") | $raw %]
35 [% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %]
36 [% CASE 'invalid_field_weight' %]
37 [% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %]
38 [% CASE 'missing_mandatory_fields' %]
39 [% t("You attempted to delete all mappings for a required index, you must leave at least one mapping") | $raw %]
40 [% CASE 'error_on_update_es_mappings' %]
41 [% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %]
42 [% CASE 'reindex_required' %]
43 [% tx("Index '{index}' needs to be reindexed.", { index = m.index }) | html %]
44 [% CASE 'recreate_required' %]
45 [% tx("Index '{index}' needs to be recreated.", { index = m.index }) | html %]
46 [% CASE 'success_on_update' %]
47 [% t("Mappings updated successfully.") | $raw %]
48 [% CASE 'success_on_reset' %]
49 [% t("Mappings have been reset successfully.") | $raw %]
50 [% CASE 'elasticsearch_disabled' %]
51 [% t("Elasticsearch is currently disabled.") | $raw %]
58 <h1>Search engine configuration (Elasticsearch)</h1>
59 <div class="dialog message">
60 Warning: Any changes to the configuration will only take effect after a full reindex. Until then searching may not work correctly.
62 <p>Weight: define weight as a positive number. Higher numbers indicate increased relevancy.
63 <strong>Note that fields weighting works only for simple search.</strong></p>
65 <li>only search fields mapped with biblios can be weighted</li>
66 <li>search will boost/increase weighted field(s) relevancy</li>
70 <div class="dialog alert">
71 Changes have not been applied. Please check the following values:
73 [% FOREACH e IN errors %]
75 [% IF ( e.type == "malformed_mapping" ) %]
76 <span>The value "[% e.value | html %]" is not supported for mappings</span>
77 [% ELSIF ( e.type == "no_mapping" ) %]
78 <span>There is no mapping for the index [% e.value | html %]</span>
86 [% IF reset_confirm %]
87 <div class="dialog alert">
88 <h3>The current mappings you see on the screen will be erased and replaced by the mappings in the mappings.yaml file.</h3>
90 <input type="hidden" name="op" value="reset_confirmed" />
91 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, reset mappings</button>
95 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not reset mappings</button>
100 <div id="tabs" class="toptabs" style="clear:both">
102 <li><a href="#search_fields">Search fields</a></li>
103 [% FOREACH index IN indexes %]
104 [% SWITCH index.index_name %]
105 [% CASE 'biblios' %]<li><a href="#mapping_biblios">Bibliographic records</a></li>
106 [% CASE 'authorities' %]<li><a href="#mapping_authorities">Authorities</a></li>
110 <div id="search_fields">
111 <table class="search_fields" id="search_fields_table">
119 <th colspan="2">Searchable</th>
122 <th colspan="5" class="NoSort"> </th>
123 <th class="NoSort">Staff interface</th>
124 <th class="NoSort">OPAC</th>
128 [% FOREACH search_field IN all_search_fields %]
130 <td data-order="[% search_field.name | html %]">
131 [% IF search_field.mandatory %]
132 <input type="text" name="search_field_name" value="[% search_field.name | html %]" readonly />
134 <input type="text" name="search_field_name" value="[% search_field.name | html %]" />
138 [% search_field.aliases.join(', ') | html %]
140 <td data-order="[% search_field.label | html %]">
141 [% IF search_field.mandatory %]
142 <input type="text" name="search_field_label" value="[% search_field.label | html %]" readonly />
144 <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
147 <td data-order="[% search_field.type | html %]">
148 [% IF search_field.mandatory %]
149 <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
150 <select name="search_field_type" disabled>
152 <select name="search_field_type">
154 <option value=""></option>
155 [% IF search_field.type == "string" %]
156 <option value="string" selected="selected">String</option>
158 <option value="string">String</option>
160 [% IF search_field.type == "date" %]
161 <option value="date" selected="selected">Date</option>
163 <option value="date">Date</option>
165 [% IF search_field.type == "year" %]
166 <option value="year" selected="selected">Year</option>
168 <option value="year">Year</option>
170 [% IF search_field.type == "number" %]
171 <option value="number" selected="selected">Number</option>
173 <option value="number">Number</option>
175 [% IF search_field.type == "boolean" %]
176 <option value="boolean" selected="selected">Boolean</option>
178 <option value="boolean">Boolean</option>
180 [% IF search_field.type == "sum" %]
181 <option value="sum" selected="selected">Sum</option>
183 <option value="sum">Sum</option>
185 [% IF search_field.type == "isbn" %]
186 <option value="isbn" selected="selected">ISBN</option>
188 <option value="isbn">ISBN</option>
190 [% IF search_field.type == "stdno" %]
191 <option value="stdno" selected="selected">Std. Number</option>
193 <option value="stdno">Std. Number</option>
197 <td data-order="[% search_field.weight | html %]">
198 [% IF search_field.mapped_biblios %]
199 <input type="text" inputmode="numeric" pattern="[0-9]*" name="search_field_weight" value="[% search_field.weight | html %]" />
201 <input type="text" name="search_field_weight" value="">
205 <select name="search_field_staff_client">
206 [% IF search_field.staff_client %]
207 <option value="1" selected="selected">Yes</option>
208 <option value="0">No</option>
210 <option value="1">Yes</option>
211 <option value="0" selected="selected">No</option>
216 <select name="search_field_opac">
217 [% IF search_field.opac %]
218 <option value="1" selected="selected">Yes</option>
219 <option value="0">No</option>
221 <option value="1">Yes</option>
222 <option value="0" selected="selected">No</option>
231 [% FOREACH index IN indexes %]
232 <div id="mapping_[% index.index_name | html %]">
233 <table class="mappings" data-index_name="[% index.index_name | html %]" data-ordering="false" id="mapping_[% index.index_name | html %]_table">
235 <tr class="nodrag nodrop">
236 <th>Search field</th>
246 [% FOREACH mapping IN index.mappings %]
247 [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %]
250 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
251 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
252 [% mapping.search_field_label | html %]
255 [% IF mapping.sort == 0 %]
256 <input type="hidden" name="mapping_sort" value="0" readonly />No
258 <input type="hidden" name="mapping_sort" value="1" readonly />Yes
262 <input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %]
265 <input type="hidden" name="mapping_suggestible" value="[% mapping.suggestible | html %]" readonly />[% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %]
268 <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
271 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
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 == 0 %]
285 <option value="0" selected="selected">No</option>
286 <option value="1">Yes</option>
288 <option value="0">No</option>
289 <option value="1" selected="selected">Yes</option>
294 [% IF mapping.is_facetable %]
295 <select name="mapping_facet">
296 [% IF mapping.facet %]
297 <option value="0">No</option>
298 <option value="1" selected="selected">Yes</option>
300 <option value="0" selected="selected">No</option>
301 <option value="1">Yes</option>
305 <input type="hidden" name="mapping_facet" value="0" />
310 <select name="mapping_suggestible">
311 [% IF mapping.suggestible %]
312 <option value="0">No</option>
313 <option value="1" selected="selected">Yes</option>
315 <option value="0" selected="selected">No</option>
316 <option value="1">Yes</option>
321 <select name="mapping_search">
322 [% IF mapping.search %]
323 <option value="0">No</option>
324 <option value="1" selected="selected">Yes</option>
326 <option value="0" selected="selected">No</option>
327 <option value="1">Yes</option>
332 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
334 [% IF mapping.search_field_mandatory %]
335 <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>
337 <td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
344 <tr class="nodrag nodrop">
346 <input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" />
347 <select data-id="mapping_search_field_name">
348 [% FOREACH f IN all_search_fields %]
349 <option value="[% f.name | html %]">[% f.name | html %]</option>
354 <select data-id="mapping_sort">
355 <option value="undef">Undef</option>
356 <option value="0">0</option>
357 <option value="1">1</option>
361 <select data-id="mapping_facet">
362 [% IF mapping.facet %]
363 <option value="0">No</option>
364 <option value="1" selected="selected">Yes</option>
366 <option value="0" selected="selected">No</option>
367 <option value="1">Yes</option>
372 <select data-id="mapping_suggestible">
373 [% IF mapping.suggestible %]
374 <option value="0">No</option>
375 <option value="1" selected="selected">Yes</option>
377 <option value="0" selected="selected">No</option>
378 <option value="1">Yes</option>
383 <select data-id="mapping_search">
384 [% IF mapping.search %]
385 <option value="0">No</option>
386 <option value="1" selected="selected">Yes</option>
388 <option value="0" selected="selected">No</option>
389 <option value="1">Yes</option>
393 <td><input data-id="mapping_marc_field" type="text" /></td>
394 <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
399 [% IF index.index_name == 'biblios' %]
401 <div id="facet_[% index.index_name | html %]">
405 <th>Search field</th>
411 [% FOREACH f IN facetable_fields %]
418 [% CASE 'author' %]Authors
419 [% CASE 'itype' %]Item Types
420 [% CASE 'location' %]Locations
421 [% CASE 'su-geo' %]Places
422 [% CASE 'title-series' %]Series
423 [% CASE 'subject' %]Topics
424 [% CASE 'ccode' %]Collections
425 [% CASE 'holdingbranch' %]Holding libraries
426 [% CASE 'homebranch' %]Home libraries
427 [% CASE 'ln' %]Language
428 [% CASE %][% f | html %]
432 [% IF f.facet_order %]
433 <input type="checkbox" name="display_facet" value="[% f.name | html %]" checked="checked" />
435 <input type="checkbox" name="display_facet" value="[% f.name | html %]" />
447 <fieldset class="action">
448 <button class="btn btn-default" type="submit" name="op" value="edit"><i class="fa fa-hdd-o" aria-hidden="true"></i> Save</button>
449 <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa fa-refresh" aria-hidden="true"></i> Reset Mappings</button>
454 </div> <!-- /.col-sm-10.col-sm-push-2 -->
456 <div class="col-sm-2 col-sm-pull-10">
458 [% INCLUDE 'admin-menu.inc' %]
460 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
461 </div> <!-- /.row -->
463 [% MACRO jsinclude BLOCK %]
464 [% INCLUDE 'datatables.inc' %]
465 [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %]
466 [% Asset.js("js/elasticsearch-mappings.js") | $raw %]
469 [% INCLUDE 'intranet-bottom.inc' %]