Bug 30733: [22.05] Simplify translatable strings
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / searchengine / elasticsearch / mappings.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% PROCESS 'i18n.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Search engine configuration (Elasticsearch) &rsaquo; Administration &rsaquo; Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <style>
9 a.add, a.delete {
10     cursor: pointer;
11 }
12 </style>
13 </head>
14
15 <body id="admin_searchengine_mappings" class="admin">
16 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'prefs-admin-search.inc' %]
18
19 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
20     <ol>
21         <li>
22             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23         </li>
24         <li>
25             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
26         </li>
27         <li>
28             <a href="#" aria-current="page">
29                 Search engine configuration (Elasticsearch)
30             </a>
31         </li>
32     </ol>
33 </nav>
34
35 [% INCLUDE 'blocking_errors.inc' %]
36
37 <div class="main container-fluid">
38     <div class="row">
39         <div class="col-sm-10 col-sm-push-2">
40             <main>
41
42     [% FOR m IN messages %]
43       <div class="dialog [% m.type | html %]">
44         [% SWITCH m.code %]
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 %]
66         [% CASE %]
67           [% m.code | html %]
68         [% END %]
69       </div>
70     [% END %]
71
72     <h1>Search engine configuration (Elasticsearch)</h1>
73
74     [% IF errors %]
75         <div class="dialog alert">
76         Changes have not been applied. Please check the following values:
77           <ul>
78             [% FOREACH e IN errors %]
79                 <li>
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>
84                     [% END %]
85                 </li>
86             [% END %]
87           </ul>
88         </div>
89     [% END %]
90
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>
94             <form method="post">
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>
97             </form>
98
99             <form method="post">
100                 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not reset mappings</button>
101             </form>
102         </div>
103     [% END %]
104
105     <div class="note">
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.
108
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>
111         <ol>
112           <li>Only search fields mapped with biblios can be weighted</li>
113           <li>Search will boost/increase weighted field(s) relevancy</li>
114         </ol>
115     </div>
116
117     <form id="es_mappings" method="post">
118         <div id="tabs" class="toptabs">
119             <ul class="nav nav-tabs" role="tablist">
120                 <li role="presentation" class="active">
121                     <a href="#search_fields" data-tab="search_fields" aria-controls="search_fields" role="tab" data-toggle="tab" >Search fields</a>
122                 </li>
123                 [% FOREACH index IN indexes %]
124                     [% SWITCH index.index_name %]
125                         [% CASE 'biblios' %]
126                             <li role="presentation">
127                                 <a href="#mapping_biblios" data-tab="mapping_biblios" aria-controls="mapping_biblios" role="tab" data-toggle="tab">Bibliographic records</a>
128                             </li>
129                         [% CASE 'authorities' %]
130                             <li role="presentation">
131                                 <a href="#mapping_authorities" data-tab="mapping_authorities" aria-controls="mapping_authorities" role="tab" data-toggle="tab">Authorities</a>
132                             </li>
133                     [% END %]
134                 [% END %]
135             </ul>
136             <div class="tab-content">
137                 <div id="search_fields" role="tabpanel" class="tab-pane active">
138                     <table class="search_fields" id="search_fields_table">
139                         <thead>
140                         <tr>
141                             <th>Name</th>
142                             <th>Aliases</th>
143                             <th>Label</th>
144                             <th>Type</th>
145                             <th>Weight</th>
146                             <th colspan="2">Searchable</th>
147                         </tr>
148                         <tr>
149                             <th colspan="5" class="NoSort">&nbsp;</th>
150                             <th class="NoSort">Staff interface</th>
151                             <th class="NoSort">OPAC</th>
152                         </tr>
153                         </thead>
154                         <tbody>
155                         [% FOREACH search_field IN all_search_fields %]
156                             <tr>
157                             <td data-order="[% search_field.name | html %]">
158                                 [% IF search_field.mandatory %]
159                                     <input type="text" name="search_field_name" value="[% search_field.name | html %]" readonly />
160                                 [% ELSE %]
161                                     <input type="text" name="search_field_name" value="[% search_field.name | html %]" />
162                                 [% END %]
163                             </td>
164                             <td>
165                                 [% search_field.aliases.join(', ') | html %]
166                             </td>
167                             <td data-order="[% search_field.label | html %]">
168                                 [% IF search_field.mandatory %]
169                                     <input type="text" name="search_field_label" value="[% search_field.label | html %]" readonly />
170                                 [% ELSE %]
171                                     <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
172                                 [% END %]
173                             </td>
174                             <td data-order="[% search_field.type | html %]">
175                                 [% IF search_field.mandatory %]
176                                     <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
177                                     <select name="search_field_type" disabled>
178                                 [% ELSE %]
179                                     <select name="search_field_type">
180                                 [% END %]
181                                     <option value=""></option>
182                                     [% IF search_field.type == "string" %]
183                                         <option value="string" selected="selected">String</option>
184                                     [% ELSE %]
185                                         <option value="string">String</option>
186                                     [% END %]
187                                     [% IF search_field.type == "date" %]
188                                         <option value="date" selected="selected">Date</option>
189                                     [% ELSE %]
190                                         <option value="date">Date</option>
191                                     [% END %]
192                                     [% IF search_field.type == "year" %]
193                                         <option value="year" selected="selected">Year</option>
194                                     [% ELSE %]
195                                         <option value="year">Year</option>
196                                     [% END %]
197                                     [% IF search_field.type == "number" %]
198                                         <option value="number" selected="selected">Number</option>
199                                     [% ELSE %]
200                                         <option value="number">Number</option>
201                                     [% END %]
202                                     [% IF search_field.type == "boolean" %]
203                                         <option value="boolean" selected="selected">Boolean</option>
204                                     [% ELSE %]
205                                         <option value="boolean">Boolean</option>
206                                     [% END %]
207                                     [% IF search_field.type == "sum" %]
208                                         <option value="sum" selected="selected">Sum</option>
209                                     [% ELSE %]
210                                         <option value="sum">Sum</option>
211                                     [% END %]
212                                     [% IF search_field.type == "isbn" %]
213                                         <option value="isbn" selected="selected">ISBN</option>
214                                     [% ELSE %]
215                                         <option value="isbn">ISBN</option>
216                                     [% END %]
217                                     [% IF search_field.type == "stdno" %]
218                                         <option value="stdno" selected="selected">Std. Number</option>
219                                     [% ELSE %]
220                                         <option value="stdno">Std. Number</option>
221                                     [% END %]
222                                     </select>
223                             </td>
224                                 <td data-order="[% search_field.weight | html %]">
225                                     [% IF search_field.mapped_biblios %]
226                                         <input type="text" inputmode="decimal" pattern="[0-9\.]*" name="search_field_weight" value="[% search_field.weight | html %]" />
227                                     [% ELSE %]
228                                         <input type="text" name="search_field_weight" value="">
229                                     [% END %]
230                                 </td>
231                             <td>
232                                 <select name="search_field_staff_client">
233                                 [% IF search_field.staff_client %]
234                                     <option value="1" selected="selected">Yes</option>
235                                     <option value="0">No</option>
236                                 [% ELSE %]
237                                     <option value="1">Yes</option>
238                                     <option value="0" selected="selected">No</option>
239                                 [% END %]
240                                 </select>
241                             </td>
242                             <td>
243                                 <select name="search_field_opac">
244                                 [% IF search_field.opac %]
245                                     <option value="1" selected="selected">Yes</option>
246                                     <option value="0">No</option>
247                                 [% ELSE %]
248                                     <option value="1">Yes</option>
249                                     <option value="0" selected="selected">No</option>
250                                 [% END %]
251                                 </select>
252                             </td>
253                             </tr>
254                         [% END %]
255                         </tbody>
256                     </table>
257                 </div>
258                 [% FOREACH index IN indexes %]
259                     <div id="mapping_[% index.index_name | html %]" role="tabpanel" class="tab-pane">
260                         <table class="mappings" data-index_name="[% index.index_name | html %]" data-ordering="false" id="mapping_[% index.index_name | html %]_table">
261                         <thead>
262                             <tr class="nodrag nodrop">
263                             <th>Search field</th>
264                             <th>Sortable</th>
265                             <th>Facetable</th>
266                             <th>Suggestible</th>
267                             <th>Searchable</th>
268                             <th>Mapping</th>
269                             <th>&nbsp;</th>
270                             </tr>
271                         </thead>
272                         <tbody>
273                             [% FOREACH mapping IN index.mappings %]
274                                 [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %]
275                                 <tr>
276                                     <td>
277                                     <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
278                                     <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
279                                     [% mapping.search_field_label | html %]
280                                     </td>
281                                     <td>
282                                     [% IF mapping.sort == 0 %]
283                                         <input type="hidden" name="mapping_sort" value="0" readonly />No
284                                     [% ELSE %]
285                                         <input type="hidden" name="mapping_sort" value="1" readonly />Yes
286                                     [% END %]
287                                     </td>
288                                     <td>
289                                     <input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %]
290                                     </td>
291                                     <td>
292                                     <input type="hidden" name="mapping_suggestible" value="[% mapping.suggestible | html %]" readonly />[% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %]
293                                     </td>
294                                     <td>
295                                     <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
296                                     </td>
297                                     <td>
298                                         <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
299                                     </td>
300                                     <td>&nbsp;</td>
301                                 </tr>
302                                 [% ELSE %]
303                                 <tr>
304                                     <td>
305                                     <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
306                                     <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
307                                     [% mapping.search_field_label | html %]
308                                     </td>
309                                     <td>
310                                     <select name="mapping_sort">
311                                         [% IF mapping.sort == 0 %]
312                                         <option value="0" selected="selected">No</option>
313                                         <option value="1">Yes</option>
314                                         [% ELSE %]
315                                         <option value="0">No</option>
316                                         <option value="1" selected="selected">Yes</option>
317                                         [% END %]
318                                     </select>
319                                     </td>
320                                     <td>
321                                     [% IF mapping.is_facetable %]
322                                         <select name="mapping_facet">
323                                         [% IF mapping.facet %]
324                                             <option value="0">No</option>
325                                             <option value="1" selected="selected">Yes</option>
326                                         [% ELSE %]
327                                             <option value="0" selected="selected">No</option>
328                                             <option value="1">Yes</option>
329                                         [% END %]
330                                         </select>
331                                     [% ELSE %]
332                                         <input type="hidden" name="mapping_facet" value="0" />
333                                         No
334                                     [% END %]
335                                     </td>
336                                     <td>
337                                     <select name="mapping_suggestible">
338                                         [% IF mapping.suggestible %]
339                                         <option value="0">No</option>
340                                         <option value="1" selected="selected">Yes</option>
341                                         [% ELSE %]
342                                         <option value="0" selected="selected">No</option>
343                                         <option value="1">Yes</option>
344                                         [% END %]
345                                     </select>
346                                     </td>
347                                     <td>
348                                     <select name="mapping_search">
349                                         [% IF mapping.search %]
350                                         <option value="0">No</option>
351                                         <option value="1" selected="selected">Yes</option>
352                                         [% ELSE %]
353                                         <option value="0" selected="selected">No</option>
354                                         <option value="1">Yes</option>
355                                         [% END %]
356                                     </select>
357                                     </td>
358                                     <td>
359                                         <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
360                                     </td>
361                                     [% IF mapping.search_field_mandatory %]
362                                         <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>
363                                     [% ELSE %]
364                                         <td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
365                                     [% END %]
366                                 </tr>
367                                 [% END %]
368                             [% END %]
369                         </tbody>
370                         <tfoot>
371                             <tr class="nodrag nodrop">
372                             <td>
373                                 <input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" />
374                                 <select data-id="mapping_search_field_name">
375                                 [% FOREACH f IN all_search_fields %]
376                                 <option value="[% f.name | html %]">[% f.name | html %]</option>
377                                 [% END %]
378                                 </select>
379                             </td>
380                             <td>
381                                 <select data-id="mapping_sort">
382                                 <option value="undef">Undef</option>
383                                 <option value="0">0</option>
384                                 <option value="1">1</option>
385                                 </select>
386                             </td>
387                             <td>
388                                 <select data-id="mapping_facet">
389                                 [% IF mapping.facet %]
390                                     <option value="0">No</option>
391                                     <option value="1" selected="selected">Yes</option>
392                                 [% ELSE %]
393                                     <option value="0" selected="selected">No</option>
394                                     <option value="1">Yes</option>
395                                 [% END %]
396                                 </select>
397                             </td>
398                             <td>
399                                 <select data-id="mapping_suggestible">
400                                 [% IF mapping.suggestible %]
401                                     <option value="0">No</option>
402                                     <option value="1" selected="selected">Yes</option>
403                                 [% ELSE %]
404                                     <option value="0" selected="selected">No</option>
405                                     <option value="1">Yes</option>
406                                 [% END %]
407                                 </select>
408                             </td>
409                             <td>
410                                 <select data-id="mapping_search">
411                                 [% IF mapping.search %]
412                                     <option value="0">No</option>
413                                     <option value="1" selected="selected">Yes</option>
414                                 [% ELSE %]
415                                     <option value="0" selected="selected">No</option>
416                                     <option value="1">Yes</option>
417                                 [% END %]
418                                 </select>
419                             </td>
420                             <td><input data-id="mapping_marc_field" type="text" /></td>
421                             <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
422                             </tr>
423                         </tfoot>
424                         </table>
425
426                         [% IF index.index_name == 'biblios' %]
427                             <h3>Facet order</h3>
428                             <div id="facet_[% index.index_name | html %]" class="ui-tabs-panel">
429                                 <table>
430                                     <thead>
431                                         <tr>
432                                             <th>Search field</th>
433                                             <th>Label</th>
434                                             <th>Display</th>
435                                         </tr>
436                                     </thead>
437                                     <tbody>
438                                         [% FOREACH f IN facetable_fields %]
439                                             <tr>
440                                                 <td>
441                                                     [% f.name | html %]
442                                                 </td>
443                                                 <td>
444                                                     [% SWITCH f.name %]
445                                                     [% CASE 'author' %]<span>Authors</span>
446                                                     [% CASE 'itype' %]<span>Item types</span>
447                                                     [% CASE 'location' %]<span>Locations</span>
448                                                     [% CASE 'su-geo' %]<span>Places</span>
449                                                     [% CASE 'title-series' %]<span>Series</span>
450                                                     [% CASE 'subject' %]<span>Topics</span>
451                                                     [% CASE 'ccode' %]<span>Collections</span>
452                                                     [% CASE 'holdingbranch' %]<span>Holding libraries</span>
453                                                     [% CASE 'homebranch' %]<span>Home libraries</span>
454                                                     [% CASE 'ln' %]<span>Language</span>
455                                                     [% CASE %][% f | html %]
456                                                     [% END %]
457                                                 </td>
458                                                 <td>
459                                                     [% IF f.facet_order %]
460                                                         <input type="checkbox" name="display_facet" value="[% f.name | html %]" checked="checked" />
461                                                     [% ELSE %]
462                                                         <input type="checkbox" name="display_facet" value="[% f.name | html %]" />
463                                                     [% END %]
464                                                 </td>
465                                             </tr>
466                                         [% END %]
467                                     </tbody>
468                                 </table>
469                             </div>
470                         [% END %]
471                     </div>
472                 [% END %]
473             </div> <!-- /.tab-content -->
474         </div> <!-- /#tabs -->
475         <fieldset class="action">
476             <button class="btn btn-default" type="submit" name="op" value="edit"><i class="fa fa-hdd-o" aria-hidden="true"></i> Save</button>
477             <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa fa-refresh" aria-hidden="true"></i> Reset mappings</button>
478         </fieldset>
479     </form>
480
481             </main>
482         </div> <!-- /.col-sm-10.col-sm-push-2 -->
483
484         <div class="col-sm-2 col-sm-pull-10">
485             <aside>
486                 [% INCLUDE 'admin-menu.inc' %]
487             </aside>
488         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
489      </div> <!-- /.row -->
490
491 [% MACRO jsinclude BLOCK %]
492     [% INCLUDE 'datatables.inc' %]
493     [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %]
494     [% Asset.js("js/elasticsearch-mappings.js") | $raw %]
495 [% END %]
496
497 [% INCLUDE 'intranet-bottom.inc' %]