]> git.koha-community.org Git - koha.git/blob - koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt
Bug 32910: (follow-up) Replace v4 icon names with v6
[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 [% WRAPPER 'header.inc' %]
17     [% INCLUDE 'prefs-admin-search.inc' %]
18 [% END %]
19
20 [% WRAPPER 'sub-header.inc' %]
21     [% WRAPPER breadcrumbs %]
22         [% WRAPPER breadcrumb_item %]
23             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
24         [% END %]
25         [% WRAPPER breadcrumb_item bc_active= 1 %]
26             <span>Search engine configuration (Elasticsearch)</span>
27         [% END %]
28     [% END #/ WRAPPER breadcrumbs %]
29 [% END #/ WRAPPER sub-header.inc %]
30
31 [% INCLUDE 'blocking_errors.inc' %]
32
33 <div class="main container-fluid">
34     <div class="row">
35         <div class="col-sm-10 col-sm-push-2">
36             <main>
37
38     [% FOR m IN messages %]
39       <div class="dialog [% m.type | html %]">
40         [% SWITCH m.code %]
41         [% CASE 'error_on_update' %]
42           [% tx("An error occurred when updating mappings: {message}.", { message = m.message }) | html %]
43         [% CASE 'error_on_delete' %]
44           [% t("An error occurred when deleting the existing mappings. Nothing has been changed!") | $raw %]
45           [% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %]
46         [% CASE 'invalid_field_weight' %]
47           [% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %]
48         [% CASE 'missing_mandatory_fields' %]
49           [% t("You attempted to delete all mappings for a required index, you must leave at least one mapping") | $raw %]
50         [% CASE 'error_on_update_es_mappings' %]
51           [% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %]
52         [% CASE 'reindex_required' %]
53           [% tx("Index '{index}' needs to be reindexed.", { index = m.index }) | html %]
54         [% CASE 'recreate_required' %]
55           [% tx("Index '{index}' needs to be recreated.", { index = m.index }) | html %]
56         [% CASE 'success_on_update' %]
57           [% t("Mappings updated successfully.") | $raw %]
58         [% CASE 'success_on_reset' %]
59           [% t("Mappings have been reset successfully.") | $raw %]
60         [% CASE 'elasticsearch_disabled' %]
61           [% t("Elasticsearch is currently disabled.") | $raw %]
62         [% CASE %]
63           [% m.code | html %]
64         [% END %]
65       </div>
66     [% END %]
67
68     <h1>Search engine configuration (Elasticsearch)</h1>
69
70     [% IF errors %]
71         <div class="dialog alert">
72         Changes have not been applied. Please check the following values:
73           <ul>
74             [% FOREACH e IN errors %]
75                 <li>
76                     [% IF ( e.type == "malformed_mapping" ) %]
77                         <span>The value "[% e.value | html %]" is not supported for mappings</span>
78                     [% ELSIF ( e.type == "no_mapping" ) %]
79                         <span>There is no mapping for the index [% e.value | html %]</span>
80                     [% END %]
81                 </li>
82             [% END %]
83           </ul>
84         </div>
85     [% END %]
86
87     [% IF reset_confirm %]
88         <div class="dialog alert">
89             <h3>The current mappings you see on the screen will be erased and replaced by the mappings in the mappings.yaml file.</h3>
90             <form method="post">
91                 <input type="hidden" name="op" value="reset_confirmed" />
92                 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, reset mappings</button>
93             </form>
94
95             <form method="post">
96                 <button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not reset mappings</button>
97             </form>
98         </div>
99     [% END %]
100
101     <div class="note">
102         <i class="fa fa-exclamation"></i>
103         <strong>Warning:</strong> Any changes to the configuration will only take effect after a full reindex. Until then searching may not work correctly.
104
105         <p><strong>Weight:</strong> define weight as a positive number. Higher numbers indicate increased relevancy.
106         <strong>Note that fields weighting works only for simple search.</strong></p>
107         <ol>
108           <li>Only search fields mapped with biblios can be weighted</li>
109           <li>Search will boost/increase weighted field(s) relevancy</li>
110         </ol>
111     </div>
112
113     <form id="es_mappings" method="post">
114
115         [% WRAPPER tabs id= "tabs" %]
116
117             [% WRAPPER tabs_nav %]
118                 [% WRAPPER tab_item tabname= "search_fields" bt_active= 1 %] Search fields [% END %]
119                 [% FOREACH index IN indexes %]
120                     [% SWITCH index.index_name %]
121                         [% CASE 'biblios' %]
122                             [% WRAPPER tab_item tabname= "mapping_biblios" %] <span>Bibliographic records</span> [% END %]
123                         [% CASE 'authorities' %]
124                             [% WRAPPER tab_item tabname= "mapping_authorities" %] <span>Authorities</span> [% END %]
125                     [% END %]
126                 [% END %]
127             [% END # /WRAPPER tabs_nav %]
128
129             [% WRAPPER tab_panels %]
130                 [% WRAPPER tab_panel tabname="search_fields" bt_active= 1 %]
131                     <table class="search_fields" id="search_fields_table">
132                         <thead>
133                             <tr>
134                                 <th>Name</th>
135                                 <th>Aliases</th>
136                                 <th>Label</th>
137                                 <th>Type</th>
138                                 <th>Weight</th>
139                                 <th colspan="2">Searchable</th>
140                             </tr>
141                             <tr>
142                                 <th colspan="5" class="NoSort">&nbsp;</th>
143                                 <th class="NoSort">Staff interface</th>
144                                 <th class="NoSort">OPAC</th>
145                             </tr>
146                         </thead>
147                         <tbody>
148                             [% FOREACH search_field IN all_search_fields %]
149                                 <tr>
150                                     <td data-order="[% search_field.name | html %]">
151                                         [% IF search_field.mandatory %]
152                                             <input type="text" name="search_field_name" value="[% search_field.name | html %]" readonly />
153                                         [% ELSE %]
154                                             <input type="text" name="search_field_name" value="[% search_field.name | html %]" />
155                                         [% END %]
156                                     </td>
157                                     <td>
158                                         [% search_field.aliases.join(', ') | html %]
159                                     </td>
160                                     <td data-order="[% search_field.label | html %]">
161                                         [% IF search_field.mandatory %]
162                                             <input type="text" name="search_field_label" value="[% search_field.label | html %]" readonly />
163                                         [% ELSE %]
164                                             <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
165                                         [% END %]
166                                     </td>
167                                     <td data-order="[% search_field.type | html %]">
168                                         [% IF search_field.mandatory %]
169                                             <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
170                                             <select name="search_field_type" disabled>
171                                         [% ELSE %]
172                                             <select name="search_field_type">
173                                         [% END %]
174                                             <option value=""></option>
175                                             [% IF search_field.type == "string" %]
176                                                 <option value="string" selected="selected">String</option>
177                                             [% ELSE %]
178                                                 <option value="string">String</option>
179                                             [% END %]
180                                             [% IF search_field.type == "date" %]
181                                                 <option value="date" selected="selected">Date</option>
182                                             [% ELSE %]
183                                                 <option value="date">Date</option>
184                                             [% END %]
185                                             [% IF search_field.type == "year" %]
186                                                 <option value="year" selected="selected">Year</option>
187                                             [% ELSE %]
188                                                 <option value="year">Year</option>
189                                             [% END %]
190                                             [% IF search_field.type == "number" %]
191                                                 <option value="number" selected="selected">Number</option>
192                                             [% ELSE %]
193                                                 <option value="number">Number</option>
194                                             [% END %]
195                                             [% IF search_field.type == "boolean" %]
196                                                 <option value="boolean" selected="selected">Boolean</option>
197                                             [% ELSE %]
198                                                 <option value="boolean">Boolean</option>
199                                             [% END %]
200                                             [% IF search_field.type == "sum" %]
201                                                 <option value="sum" selected="selected">Sum</option>
202                                             [% ELSE %]
203                                                 <option value="sum">Sum</option>
204                                             [% END %]
205                                             [% IF search_field.type == "isbn" %]
206                                                 <option value="isbn" selected="selected">ISBN</option>
207                                             [% ELSE %]
208                                                 <option value="isbn">ISBN</option>
209                                             [% END %]
210                                             [% IF search_field.type == "stdno" %]
211                                                 <option value="stdno" selected="selected">Std. Number</option>
212                                             [% ELSE %]
213                                                 <option value="stdno">Std. Number</option>
214                                             [% END %]
215                                             [% IF search_field.type == "callnumber" %]
216                                                 <option value="callnumber" selected="selected">Call Number</option>
217                                             [% ELSE %]
218                                                 <option value="callnumber">Call Number</option>
219                                             [% END %]
220                                         </select>
221                                     </td>
222                                         <td data-order="[% search_field.weight | html %]">
223                                             [% IF search_field.mapped_biblios %]
224                                                 <input type="text" inputmode="decimal" pattern="[0-9\.]*" name="search_field_weight" value="[% search_field.weight | html %]" />
225                                             [% ELSE %]
226                                                 <input type="text" name="search_field_weight" value="">
227                                             [% END %]
228                                         </td>
229                                     <td>
230                                         <select name="search_field_staff_client">
231                                             [% IF search_field.staff_client %]
232                                                 <option value="1" selected="selected">Yes</option>
233                                                 <option value="0">No</option>
234                                             [% ELSE %]
235                                                 <option value="1">Yes</option>
236                                                 <option value="0" selected="selected">No</option>
237                                             [% END %]
238                                         </select>
239                                     </td>
240                                     <td>
241                                         <select name="search_field_opac">
242                                             [% IF search_field.opac %]
243                                                 <option value="1" selected="selected">Yes</option>
244                                                 <option value="0">No</option>
245                                             [% ELSE %]
246                                                 <option value="1">Yes</option>
247                                                 <option value="0" selected="selected">No</option>
248                                             [% END %]
249                                         </select>
250                                     </td>
251                                 </tr>
252                             [% END %]
253                         </tbody>
254                     </table>
255                 [% END %]
256                 [% FOREACH index IN indexes %]
257                     [% WRAPPER tab_panel tabname="mapping_${ index.index_name }" %]
258                         <table class="mappings" data-index_name="[% index.index_name | html %]" data-ordering="false" id="mapping_[% index.index_name | html %]_table">
259                             <thead>
260                                 <tr class="nodrag nodrop">
261                                 <th>Search field</th>
262                                 <th>Sortable</th>
263                                 <th>Facetable</th>
264                                 <th>Suggestible</th>
265                                 <th>Searchable</th>
266                                 <th>Mapping</th>
267                                 <th>&nbsp;</th>
268                                 </tr>
269                             </thead>
270                             <tbody>
271                                 [% FOREACH mapping IN index.mappings %]
272                                     [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %]
273                                         <tr>
274                                             <td>
275                                                 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
276                                                 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
277                                                 [% mapping.search_field_name | html %]
278                                                 [% IF mapping.search_field_label != mapping.search_field_name %] ([% mapping.search_field_label | html %])[% END %]
279                                             </td>
280                                             <td>
281                                                 [% IF mapping.sort == 0 %]
282                                                     <input type="hidden" name="mapping_sort" value="0" readonly />No
283                                                 [% ELSE %]
284                                                     <input type="hidden" name="mapping_sort" value="1" readonly />Yes
285                                                 [% END %]
286                                             </td>
287                                             <td>
288                                                 <input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %]
289                                             </td>
290                                             <td>
291                                                 <input type="hidden" name="mapping_suggestible" value="[% mapping.suggestible | html %]" readonly />[% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %]
292                                             </td>
293                                             <td>
294                                                 <input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %]
295                                             </td>
296                                             <td data-search="[% mapping.marc_field | html %]">
297                                                 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
298                                             </td>
299                                             <td>&nbsp;</td>
300                                         </tr>
301                                     [% ELSE %]
302                                         <tr>
303                                             <td>
304                                                 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
305                                                 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
306                                                 [% mapping.search_field_name | html %]
307                                                 [% IF mapping.search_field_label != mapping.search_field_name %] ([% mapping.search_field_label | html %])[% END %]
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 data-search="[% mapping.marc_field | html %]">
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 %][% IF f.label != f.name %] ([% f.label | html %])[% END %]</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                     [% END # /WRAPPER tab_panel#mapping_{ index.index_name} %]
472                 [% END # /FOREACH index %]
473             [% END # /WRAPPER tab_panels %]
474         [% END # /WRAPPER tabs %]
475
476         <fieldset class="action">
477             <button class="btn btn-primary" type="submit" name="op" value="edit"><i class="fa-solid fa-hard-drive" aria-hidden="true"></i> Save</button>
478             <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Reset mappings</button>
479         </fieldset>
480     </form>
481
482             </main>
483         </div> <!-- /.col-sm-10.col-sm-push-2 -->
484
485         <div class="col-sm-2 col-sm-pull-10">
486             <aside>
487                 [% INCLUDE 'admin-menu.inc' %]
488             </aside>
489         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
490      </div> <!-- /.row -->
491
492 [% MACRO jsinclude BLOCK %]
493     [% INCLUDE 'datatables.inc' %]
494     [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %]
495     [% Asset.js("js/elasticsearch-mappings.js") | $raw %]
496 [% END %]
497
498 [% INCLUDE 'intranet-bottom.inc' %]