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 [% WRAPPER 'header.inc' %]
17 [% INCLUDE 'prefs-admin-search.inc' %]
20 [% WRAPPER 'sub-header.inc' %]
21 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
24 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
27 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
30 <a href="#" aria-current="page">
31 Search engine configuration (Elasticsearch)
38 [% INCLUDE 'blocking_errors.inc' %]
40 <div class="main container-fluid">
42 <div class="col-sm-10 col-sm-push-2">
45 [% FOR m IN messages %]
46 <div class="dialog [% m.type | html %]">
48 [% CASE 'error_on_update' %]
49 [% tx("An error occurred when updating mappings: {message}.", { message = m.message }) | html %]
50 [% CASE 'error_on_delete' %]
51 [% t("An error occurred when deleting the existing mappings. Nothing has been changed!") | $raw %]
52 [% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %]
53 [% CASE 'invalid_field_weight' %]
54 [% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %]
55 [% CASE 'missing_mandatory_fields' %]
56 [% t("You attempted to delete all mappings for a required index, you must leave at least one mapping") | $raw %]
57 [% CASE 'error_on_update_es_mappings' %]
58 [% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %]
59 [% CASE 'reindex_required' %]
60 [% tx("Index '{index}' needs to be reindexed.", { index = m.index }) | html %]
61 [% CASE 'recreate_required' %]
62 [% tx("Index '{index}' needs to be recreated.", { index = m.index }) | html %]
63 [% CASE 'success_on_update' %]
64 [% t("Mappings updated successfully.") | $raw %]
65 [% CASE 'success_on_reset' %]
66 [% t("Mappings have been reset successfully.") | $raw %]
67 [% CASE 'elasticsearch_disabled' %]
68 [% t("Elasticsearch is currently disabled.") | $raw %]
75 <h1>Search engine configuration (Elasticsearch)</h1>
78 <div class="dialog alert">
79 Changes have not been applied. Please check the following values:
81 [% FOREACH e IN errors %]
83 [% IF ( e.type == "malformed_mapping" ) %]
84 <span>The value "[% e.value | html %]" is not supported for mappings</span>
85 [% ELSIF ( e.type == "no_mapping" ) %]
86 <span>There is no mapping for the index [% e.value | html %]</span>
94 [% IF reset_confirm %]
95 <div class="dialog alert">
96 <h3>The current mappings you see on the screen will be erased and replaced by the mappings in the mappings.yaml file.</h3>
98 <input type="hidden" name="op" value="reset_confirmed" />
99 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, reset mappings</button>
103 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not reset mappings</button>
109 <i class="fa fa-exclamation"></i>
110 <strong>Warning:</strong> Any changes to the configuration will only take effect after a full reindex. Until then searching may not work correctly.
112 <p><strong>Weight:</strong> 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 <form id="es_mappings" method="post">
121 <div id="tabs" class="toptabs">
122 <ul class="nav nav-tabs" role="tablist">
123 <li role="presentation" class="active">
124 <a href="#search_fields" data-tab="search_fields" aria-controls="search_fields" role="tab" data-toggle="tab" >Search fields</a>
126 [% FOREACH index IN indexes %]
127 [% SWITCH index.index_name %]
129 <li role="presentation">
130 <a href="#mapping_biblios" data-tab="mapping_biblios" aria-controls="mapping_biblios" role="tab" data-toggle="tab">Bibliographic records</a>
132 [% CASE 'authorities' %]
133 <li role="presentation">
134 <a href="#mapping_authorities" data-tab="mapping_authorities" aria-controls="mapping_authorities" role="tab" data-toggle="tab">Authorities</a>
139 <div class="tab-content">
140 <div id="search_fields" role="tabpanel" class="tab-pane active">
141 <table class="search_fields" id="search_fields_table">
149 <th colspan="2">Searchable</th>
152 <th colspan="5" class="NoSort"> </th>
153 <th class="NoSort">Staff interface</th>
154 <th class="NoSort">OPAC</th>
158 [% FOREACH search_field IN all_search_fields %]
160 <td data-order="[% search_field.name | html %]">
161 [% IF search_field.mandatory %]
162 <input type="text" name="search_field_name" value="[% search_field.name | html %]" readonly />
164 <input type="text" name="search_field_name" value="[% search_field.name | html %]" />
168 [% search_field.aliases.join(', ') | html %]
170 <td data-order="[% search_field.label | html %]">
171 [% IF search_field.mandatory %]
172 <input type="text" name="search_field_label" value="[% search_field.label | html %]" readonly />
174 <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
177 <td data-order="[% search_field.type | html %]">
178 [% IF search_field.mandatory %]
179 <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
180 <select name="search_field_type" disabled>
182 <select name="search_field_type">
184 <option value=""></option>
185 [% IF search_field.type == "string" %]
186 <option value="string" selected="selected">String</option>
188 <option value="string">String</option>
190 [% IF search_field.type == "date" %]
191 <option value="date" selected="selected">Date</option>
193 <option value="date">Date</option>
195 [% IF search_field.type == "year" %]
196 <option value="year" selected="selected">Year</option>
198 <option value="year">Year</option>
200 [% IF search_field.type == "number" %]
201 <option value="number" selected="selected">Number</option>
203 <option value="number">Number</option>
205 [% IF search_field.type == "boolean" %]
206 <option value="boolean" selected="selected">Boolean</option>
208 <option value="boolean">Boolean</option>
210 [% IF search_field.type == "sum" %]
211 <option value="sum" selected="selected">Sum</option>
213 <option value="sum">Sum</option>
215 [% IF search_field.type == "isbn" %]
216 <option value="isbn" selected="selected">ISBN</option>
218 <option value="isbn">ISBN</option>
220 [% IF search_field.type == "stdno" %]
221 <option value="stdno" selected="selected">Std. Number</option>
223 <option value="stdno">Std. Number</option>
225 [% IF search_field.type == "callnumber" %]
226 <option value="callnumber" selected="selected">Call Number</option>
228 <option value="callnumber">Call Number</option>
232 <td data-order="[% search_field.weight | html %]">
233 [% IF search_field.mapped_biblios %]
234 <input type="text" inputmode="decimal" pattern="[0-9\.]*" name="search_field_weight" value="[% search_field.weight | html %]" />
236 <input type="text" name="search_field_weight" value="">
240 <select name="search_field_staff_client">
241 [% IF search_field.staff_client %]
242 <option value="1" selected="selected">Yes</option>
243 <option value="0">No</option>
245 <option value="1">Yes</option>
246 <option value="0" selected="selected">No</option>
251 <select name="search_field_opac">
252 [% IF search_field.opac %]
253 <option value="1" selected="selected">Yes</option>
254 <option value="0">No</option>
256 <option value="1">Yes</option>
257 <option value="0" selected="selected">No</option>
266 [% FOREACH index IN indexes %]
267 <div id="mapping_[% index.index_name | html %]" role="tabpanel" class="tab-pane">
268 <table class="mappings" data-index_name="[% index.index_name | html %]" data-ordering="false" id="mapping_[% index.index_name | html %]_table">
270 <tr class="nodrag nodrop">
271 <th>Search field</th>
281 [% FOREACH mapping IN index.mappings %]
282 [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %]
285 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
286 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
287 [% mapping.search_field_label | html %]
290 [% IF mapping.sort == 0 %]
291 <input type="hidden" name="mapping_sort" value="0" readonly />No
293 <input type="hidden" name="mapping_sort" value="1" readonly />Yes
297 <input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %]
300 <input type="hidden" name="mapping_suggestible" value="[% mapping.suggestible | html %]" readonly />[% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %]
303 <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
306 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
313 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
314 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
315 [% mapping.search_field_label | html %]
318 <select name="mapping_sort">
319 [% IF mapping.sort == 0 %]
320 <option value="0" selected="selected">No</option>
321 <option value="1">Yes</option>
323 <option value="0">No</option>
324 <option value="1" selected="selected">Yes</option>
329 [% IF mapping.is_facetable %]
330 <select name="mapping_facet">
331 [% IF mapping.facet %]
332 <option value="0">No</option>
333 <option value="1" selected="selected">Yes</option>
335 <option value="0" selected="selected">No</option>
336 <option value="1">Yes</option>
340 <input type="hidden" name="mapping_facet" value="0" />
345 <select name="mapping_suggestible">
346 [% IF mapping.suggestible %]
347 <option value="0">No</option>
348 <option value="1" selected="selected">Yes</option>
350 <option value="0" selected="selected">No</option>
351 <option value="1">Yes</option>
356 <select name="mapping_search">
357 [% IF mapping.search %]
358 <option value="0">No</option>
359 <option value="1" selected="selected">Yes</option>
361 <option value="0" selected="selected">No</option>
362 <option value="1">Yes</option>
367 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
369 [% IF mapping.search_field_mandatory %]
370 <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>
372 <td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
379 <tr class="nodrag nodrop">
381 <input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" />
382 <select data-id="mapping_search_field_name">
383 [% FOREACH f IN all_search_fields %]
384 <option value="[% f.name | html %]">[% f.name | html %]</option>
389 <select data-id="mapping_sort">
390 <option value="undef">Undef</option>
391 <option value="0">0</option>
392 <option value="1">1</option>
396 <select data-id="mapping_facet">
397 [% IF mapping.facet %]
398 <option value="0">No</option>
399 <option value="1" selected="selected">Yes</option>
401 <option value="0" selected="selected">No</option>
402 <option value="1">Yes</option>
407 <select data-id="mapping_suggestible">
408 [% IF mapping.suggestible %]
409 <option value="0">No</option>
410 <option value="1" selected="selected">Yes</option>
412 <option value="0" selected="selected">No</option>
413 <option value="1">Yes</option>
418 <select data-id="mapping_search">
419 [% IF mapping.search %]
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>
428 <td><input data-id="mapping_marc_field" type="text" /></td>
429 <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
434 [% IF index.index_name == 'biblios' %]
436 <div id="facet_[% index.index_name | html %]" class="ui-tabs-panel">
440 <th>Search field</th>
446 [% FOREACH f IN facetable_fields %]
453 [% CASE 'author' %]<span>Authors</span>
454 [% CASE 'itype' %]<span>Item types</span>
455 [% CASE 'location' %]<span>Locations</span>
456 [% CASE 'su-geo' %]<span>Places</span>
457 [% CASE 'title-series' %]<span>Series</span>
458 [% CASE 'subject' %]<span>Topics</span>
459 [% CASE 'ccode' %]<span>Collections</span>
460 [% CASE 'holdingbranch' %]<span>Holding libraries</span>
461 [% CASE 'homebranch' %]<span>Home libraries</span>
462 [% CASE 'ln' %]<span>Language</span>
463 [% CASE %][% f | html %]
467 [% IF f.facet_order %]
468 <input type="checkbox" name="display_facet" value="[% f.name | html %]" checked="checked" />
470 <input type="checkbox" name="display_facet" value="[% f.name | html %]" />
481 </div> <!-- /.tab-content -->
482 </div> <!-- /#tabs -->
483 <fieldset class="action">
484 <button class="btn btn-default" type="submit" name="op" value="edit"><i class="fa fa-hdd-o" aria-hidden="true"></i> Save</button>
485 <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa fa-refresh" aria-hidden="true"></i> Reset mappings</button>
490 </div> <!-- /.col-sm-10.col-sm-push-2 -->
492 <div class="col-sm-2 col-sm-pull-10">
494 [% INCLUDE 'admin-menu.inc' %]
496 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
497 </div> <!-- /.row -->
499 [% MACRO jsinclude BLOCK %]
500 [% INCLUDE 'datatables.inc' %]
501 [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %]
502 [% Asset.js("js/elasticsearch-mappings.js") | $raw %]
505 [% INCLUDE 'intranet-bottom.inc' %]