3 [% PROCESS 'i18n.inc' %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Administration › Search engine configuration</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %]
9 function clean_line( line ) {
10 $(line).find('input[type="text"]').val("");
11 $(line).find('select').find('option:first').attr("selected", "selected");
14 function clone_line( line ) {
15 var new_line = $(line).clone();
16 $(new_line).removeClass("nodrag nodrop");
17 $(new_line).find('td:last-child>a').removeClass("add").addClass("delete").html(_("Delete"));
18 $(new_line).find('[data-id]').each( function() {
19 $(this).attr({ name: $(this).attr('data-id') }).removeAttr('data-id');
21 $(new_line).find("select").each( function() {
22 var attr = $(this).attr('name');
23 var val = $(line).find('[data-id="' + attr + '"]').val();
24 $(this).find('option[value="' + val + '"]').attr("selected", "selected");
29 $(document).ready(function() {
31 $('.delete').click(function() {
32 $(this).parents('tr').remove();
35 $("table.mappings").tableDnD( {
36 onDragClass: "dragClass",
38 $('.add').click(function() {
39 var table = $(this).closest('table');
40 var index_name = $(table).attr('data-index_name');
41 var line = $(this).closest("tr");
42 var marc_field = $(line).find('input[data-id="mapping_marc_field"]').val();
43 if ( marc_field.length > 0 ) {
44 var new_line = clone_line( line );
45 new_line.appendTo($('table[data-index_name="'+index_name+'"]>tbody'));
46 $('.delete').click(function() {
47 $(this).parents('tr').remove();
52 onDragClass: "dragClass",
56 $("#facet_biblios > table").tableDnD( {
57 onDragClass: "dragClass",
67 <body id="admin_searchengine_mappings" class="admin">
68 [% INCLUDE 'header.inc' %]
69 [% INCLUDE 'prefs-admin-search.inc' %]
71 <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</div>
73 <div class="main container-fluid">
75 <div class="col-sm-10 col-sm-push-2">
78 [% FOR m IN messages %]
79 <div class="dialog [% m.type | html %]">
81 [% CASE 'error_on_update' %]
82 [% tx("An error occurred when updating mappings: {message}.", { message = m.message }) | html %]
83 [% CASE 'error_on_delete' %]
84 [% t("An error occurred when deleting the existing mappings. Nothing has been changed!") | $raw %]
85 [% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %]
86 [% CASE 'invalid_field_weight' %]
87 [% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %]
88 [% CASE 'error_on_update_es_mappings' %]
89 [% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %]
90 [% CASE 'reindex_required' %]
91 [% tx("Index '{index}' needs to be reindexed.", { index = m.index }) | html %]
92 [% CASE 'recreate_required' %]
93 [% tx("Index '{index}' needs to be recreated.", { index = m.index }) | html %]
94 [% CASE 'success_on_update' %]
95 [% t("Mappings updated successfully.") | $raw %]
96 [% CASE 'success_on_reset' %]
97 [% t("Mappings have been reset successfully.") | $raw %]
104 <h1>Search engine configuration</h1>
105 <div class="dialog message">
106 Warning: Any changes to the configuration will only take effect after a full reindex. Until then searching may not work correctly.
108 <p>Weight: define weight as a positive number. Higher numbers indicate increased relevancy.
109 <strong>Note that fields weighting works only for simple search.</strong></p>
111 <li>only search fields mapped with biblios can be weighted</li>
112 <li>search will boost/increase weighted field(s) relevancy</li>
116 <div class="dialog alert">
117 Changes have not been applied. Please check the following values:
119 [% FOREACH e IN errors %]
121 [% IF ( e.type == "malformed_mapping" ) %]
122 <span>The value "[% e.value | html %]" is not supported for mappings</span>
123 [% ELSIF ( e.type == "no_mapping" ) %]
124 <span>There is no mapping for the index [% e.value | html %]</span>
132 [% IF reset_confirm %]
133 <div class="dialog alert">
134 <h3>The current mappings you see on the screen will be erased and replaced by the mappings in the mappings.yaml file.</h3>
136 <input type="hidden" name="op" value="reset_confirmed" />
137 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, reset mappings</button>
141 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not reset mappings</button>
146 <div id="tabs" class="toptabs" style="clear:both">
148 <li><a href="#search_fields">Search fields</a></li>
149 [% FOREACH index IN indexes %]
150 [% SWITCH index.index_name %]
151 [% CASE 'biblios' %]<li><a href="#mapping_biblios">Bibliographic records</a></li>
152 [% CASE 'authorities' %]<li><a href="#mapping_authorities">Authorities</a></li>
156 <div id="search_fields">
157 <table class="search_fields">
167 [% FOREACH search_field IN all_search_fields %]
170 <input type="text" name="search_field_name" value="[% search_field.name | html %]" />
172 <td><input type="text" name="search_field_label" value="[% search_field.label | html %]" />
174 <select name="search_field_type">
175 <option value=""></option>
176 [% IF search_field.type == "string" %]
177 <option value="string" selected="selected">String</option>
179 <option value="string">String</option>
181 [% IF search_field.type == "date" %]
182 <option value="date" selected="selected">Date</option>
184 <option value="date">Date</option>
186 [% IF search_field.type == "number" %]
187 <option value="number" selected="selected">Number</option>
189 <option value="number">Number</option>
191 [% IF search_field.type == "boolean" %]
192 <option value="boolean" selected="selected">Boolean</option>
194 <option value="boolean">Boolean</option>
196 [% IF search_field.type == "sum" %]
197 <option value="sum" selected="selected">Sum</option>
199 <option value="sum">Sum</option>
201 [% IF search_field.type == "isbn" %]
202 <option value="isbn" selected="selected">ISBN</option>
204 <option value="isbn">ISBN</option>
206 [% IF search_field.type == "stdno" %]
207 <option value="stdno" selected="selected">Std. Number</option>
209 <option value="stdno">Std. Number</option>
214 [% IF search_field.mapped_biblios %]
215 <input type="number" step="0.01" min="0.01" max="999.99" name="search_field_weight" value="[% search_field.weight | html %]" />
217 <input type="hidden" name="search_field_weight" value="">
225 [% FOREACH index IN indexes %]
226 <div id="mapping_[% index.index_name | html %]">
227 <table class="mappings" data-index_name="[% index.index_name | html %]">
229 <tr class="nodrag nodrop">
230 <th>Search field</th>
239 [% FOREACH mapping IN index.mappings %]
242 <input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" />
243 <input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]">
244 [% mapping.search_field_label | html %]
247 <select name="mapping_sort">
248 [% IF mapping.sort == 'undef' %]
249 <option value="undef" selected="selected">Undef</option>
251 <option value="undef">Undef</option>
253 [% IF mapping.sort == 0 %]
254 <option value="0" selected="selected">0</option>
256 <option value="0">0</option>
258 [% IF mapping.sort == 1 %]
259 <option value="1" selected="selected">1</option>
261 <option value="1">1</option>
266 [% IF mapping.is_facetable %]
267 <select name="mapping_facet">
268 [% IF mapping.facet %]
269 <option value="0">No</option>
270 <option value="1" selected="selected">Yes</option>
272 <option value="0" selected="selected">No</option>
273 <option value="1">Yes</option>
277 <input type="hidden" name="mapping_facet" value="0" />
282 <select name="mapping_suggestible">
283 [% IF mapping.suggestible %]
284 <option value="0">No</option>
285 <option value="1" selected="selected">Yes</option>
287 <option value="0" selected="selected">No</option>
288 <option value="1">Yes</option>
293 <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
295 <td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td>
300 <tr class="nodrag nodrop">
302 <input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" />
303 <select data-id="mapping_search_field_name">
304 [% FOREACH f IN all_search_fields %]
305 <option value="[% f.name | html %]">[% f.name | html %]</option>
310 <select data-id="mapping_sort">
311 <option value="undef">Undef</option>
312 <option value="0">0</option>
313 <option value="1">1</option>
317 <select data-id="mapping_facet">
318 [% IF mapping.facet %]
319 <option value="0">No</option>
320 <option value="1" selected="selected">Yes</option>
322 <option value="0" selected="selected">No</option>
323 <option value="1">Yes</option>
328 <select data-id="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>
338 <td><input data-id="mapping_marc_field" type="text" /></td>
339 <td><a class="btn btn-default btn-xs add"><i class="fa fa-plus"></i> Add</a></td>
344 [% IF index.index_name == 'biblios' %]
346 <div id="facet_[% index.index_name | html %]">
350 <th>Search field</th>
356 [% FOREACH f IN facetable_fields %]
363 [% CASE 'author' %]Authors
364 [% CASE 'itype' %]Item Types
365 [% CASE 'location' %]Locations
366 [% CASE 'su-geo' %]Places
367 [% CASE 'title-series' %]Series
368 [% CASE 'subject' %]Topics
369 [% CASE 'ccode' %]Collections
370 [% CASE 'holdingbranch' %]Holding libraries
371 [% CASE 'homebranch' %]Home libraries
372 [% CASE %][% f | html %]
376 [% IF f.facet_order %]
377 <input type="checkbox" name="display_facet" value="[% f.name | html %]" checked="checked" />
379 <input type="checkbox" name="display_facet" value="[% f.name | html %]" />
392 <button class="btn btn-default" type="submit" name="op" value="edit"><i class="fa fa-hdd-o" aria-hidden="true"></i> Save</button>
393 <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa fa-refresh" aria-hidden="true"></i> Reset Mappings</button>
398 </div> <!-- /.col-sm-10.col-sm-push-2 -->
400 <div class="col-sm-2 col-sm-pull-10">
402 [% INCLUDE 'admin-menu.inc' %]
404 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
405 </div> <!-- /.row -->
407 [% INCLUDE 'intranet-bottom.inc' %]