Bugzilla – Attachment 185294 Details for
Bug 27113
Elasticsearch: Autocomplete in search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27113: Fix autocomplete suggestions across Staff interface and OPAC
Bug-27113-Fix-autocomplete-suggestions-across-Staf.patch (text/plain), 11.39 KB, created by
Hammat wele
on 2025-08-08 20:04:39 UTC
(
hide
)
Description:
Bug 27113: Fix autocomplete suggestions across Staff interface and OPAC
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2025-08-08 20:04:39 UTC
Size:
11.39 KB
patch
obsolete
>From b502d5060b106b7671393cb2ad15678fbae74eb8 Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Fri, 8 Aug 2025 20:02:16 +0000 >Subject: [PATCH] Bug 27113: Fix autocomplete suggestions across Staff > interface and OPAC > >--- > ...bug_27113-elasticsearch_autocomplete_input_search.perl | 4 ++-- > installer/data/mysql/mandatory/sysprefs.sql | 4 ++-- > koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js | 2 +- > koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc | 4 ++-- > .../prog/en/modules/admin/preferences/searching.pref | 4 ++-- > .../intranet-tmpl/prog/en/modules/catalogue/advsearch.tt | 4 ++-- > koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss | 4 ++-- > koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc | 4 ++-- > .../opac-tmpl/bootstrap/en/modules/opac-advsearch.tt | 8 ++++---- > 9 files changed, 19 insertions(+), 19 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_27113-elasticsearch_autocomplete_input_search.perl b/installer/data/mysql/atomicupdate/bug_27113-elasticsearch_autocomplete_input_search.perl >index fafe0894d32..44eab76acf3 100644 >--- a/installer/data/mysql/atomicupdate/bug_27113-elasticsearch_autocomplete_input_search.perl >+++ b/installer/data/mysql/atomicupdate/bug_27113-elasticsearch_autocomplete_input_search.perl >@@ -1,9 +1,9 @@ > $DBversion = 'XXX'; # will be replaced by the RM > if( CheckVersion( $DBversion ) ) { > # you can use $dbh here like: >- $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACAutocompleteElasticSearch', '0', NULL, 'If ON, show search suggestions in the OPAC when using Elasticsearch.', 'YesNo')}); >+ $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACAutocompleteElasticsearch', '0', NULL, 'If ON, show search suggestions in the OPAC when using Elasticsearch.', 'YesNo')}); > >- $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetAutocompleteElasticSearch', '0', NULL, 'If ON, show search suggestions in the staff interface when using Elasticsearch.', 'YesNo')}); >+ $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('StaffInterfaceAutocompleteElasticsearch', '0', NULL, 'If ON, show search suggestions in the staff interface when using Elasticsearch.', 'YesNo')}); > > # Always end with this (adjust the bug info) > NewVersion( $DBversion, 27113, "Autocomplete with Elasticsearch"); >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 6c2c0ccc24a..a17822e5f6f 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -348,7 +348,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('IndependentBranchesPatronModifications','0', NULL, 'Show only modification request for the logged in branch','YesNo'), > ('IndependentBranchesTransfers','0', NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo'), > ('IntranetAddMastheadLibraryPulldown','0', NULL, 'Add a library select pulldown menu on the staff header search','YesNo'), >-('IntranetAutocompleteElasticSearch','0',NULL,'If ON, show search suggestions in the staff interface when using Elasticsearch.','YesNo'), >+('StaffInterfaceAutocompleteElasticsearch','0',NULL,'If ON, show search suggestions in the staff interface when using Elasticsearch.','YesNo'), > ('IntranetBiblioDefaultView','normal','normal|marc|isbd|labeled_marc','Choose the default detail view in the staff interface; choose between normal, labeled_marc, marc or isbd','Choice'), > ('intranetbookbag','1','','If ON, enables display of Cart feature in the intranet','YesNo'), > ('IntranetCatalogSearchPulldown','0', NULL, 'Show a search field pulldown for \"Search the catalog\" boxes','YesNo'), >@@ -485,7 +485,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'), > ('OPACAuthorIdentifiersAndInformation', '', '', 'Display author information on the OPAC detail page','multiple_sortable'), > ('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'), >-('OPACAutocompleteElasticSearch','0',NULL,'If ON, show search suggestions in the OPAC when using Elasticsearch.','YesNo'), >+('OPACAutocompleteElasticsearch','0',NULL,'If ON, show search suggestions in the OPAC when using Elasticsearch.','YesNo'), > ('OPACBaseURL','',NULL,'Specify the Base URL of the OPAC, e.g., http://opac.mylibrary.com, including the protocol (http:// or https://). Otherwise, the http:// will be added automatically by Koha upon saving.','Free'), > ('opacbookbag','1','','If ON, enables display of Cart feature','YesNo'), > ('OpacBrowser','0',NULL,'If ON, enables subject authorities browser on OPAC (needs to set misc/cronjob/sbuild_browser_and_cloud.pl)','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js b/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js >index ae89321796e..f503befc4e4 100644 >--- a/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js >+++ b/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js >@@ -158,7 +158,7 @@ function autocomplete(inp, nb, left, right) { > for (j = 0; j < tmp_data[i]['highlight'][pref[k] + '.' + key].length; j++){ > /* div with data for autocomplete */ > let tmp = tmp_data[i]['highlight'][pref[k] + '.' + key][j] >- myset.add(tmp.replace(/[ &#,+()$~%.'":*?<{}!/;]+$/g, '')); >+ myset.add(tmp.replace(/[ &#,+($~%.:*?<{!/;]+$/g, '')); > if (myset.size >= nb_autocomplete) break; > }; > if (myset.size >= nb_autocomplete) break; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >index df31beabac5..09295515505 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >@@ -98,8 +98,8 @@ > [% IF Koha.Preference( 'CookieConsent' ) %] > [% Asset.js("js/cookieconsent.js") | $raw %] > [% END %] >-<!-- Intranet inc JS IntranetAutocompleteElasticSearch --> >-[% IF ( Koha.Preference('IntranetAutocompleteElasticSearch') ) %] >+<!-- Intranet inc JS StaffInterfaceAutocompleteElasticsearch --> >+[% IF ( Koha.Preference('StaffInterfaceAutocompleteElasticsearch') ) %] > [% Asset.js("js/elasticsearch/autocomplete.js") | $raw %] > [% END %] > <!-- / js_includes.inc --> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index 877ba5ac3d3..8733ff4520c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -393,7 +393,7 @@ Searching: > class: url > - "Please only change this if you are sure it needs changing." > - >- - pref: OPACAutocompleteElasticSearch >+ - pref: OPACAutocompleteElasticsearch > type: boolean > default: 0 > choices: >@@ -401,7 +401,7 @@ Searching: > 0: "Don't show" > - search suggestions in the OPAC when using Elasticsearch. > - >- - pref: IntranetAutocompleteElasticSearch >+ - pref: StaffInterfaceAutocompleteElasticsearch > type: boolean > default: 0 > choices: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >index 64e81fb9242..bcd369b4e66 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >@@ -393,8 +393,8 @@ > var dad = line.parentNode; > dad.appendChild(line.cloneNode(true)); > line.removeChild(ButtonPlus); >- /* Intranet JS IntranetAutocompleteElasticSearch */ >- [% IF ( Koha.Preference('IntranetAutocompleteElasticSearch') ) %] >+ /* Intranet JS StaffInterfaceAutocompleteElasticsearch */ >+ [% IF ( Koha.Preference('StaffInterfaceAutocompleteElasticsearch') ) %] > AutocompleteInitIntranet(); > [% END %] > } >diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss >index 9f0f0e1d95e..d92c7b47527 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss >+++ b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss >@@ -3013,12 +3013,12 @@ fieldset.brief label.show-password-toggle-label { > > &:hover { > /*when hovering an item:*/ >- background-color: #e9e9e9; >+ background-color: lighten( $dropdown-dark-color, 20 ); > } > > &.autocomplete-active { > /*when navigating through the items using the arrow keys:*/ >- background-color: lighten( $input-btn-focus-color, 45% ); >+ background-color: lighten( $dropdown-dark-color, 20 ); > } > } > } >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index 9c54b345869..54b3ee1b530 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -192,8 +192,8 @@ > [% INCLUDE 'js-date-format.inc' %] > [% INCLUDE 'js-biblio-format.inc' %] > [% PROCESS jsinclude %] >-<!-- OPAC *.inc JS OPACAutocompleteElasticSearch --> >-[% IF ( Koha.Preference('OPACAutocompleteElasticSearch') ) %] >+<!-- OPAC *.inc JS OPACAutocompleteElasticsearch --> >+[% IF ( Koha.Preference('OPACAutocompleteElasticsearch') ) %] > [% Asset.js("js/opac-elasticsearch/opac-autocomplete.js") | $raw %] > [% END %] > [% IF ( Koha.Preference('OPACUserJS') ) %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >index 3219e350246..e2ad519a08c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >@@ -612,8 +612,8 @@ > $(newLine).find('.search-term-input select[name="op"]').first().prop("disabled",false).show(); > newLine.find('input').val(''); > thisLine.after(newLine); >- /* OPAC JS OPACAutocompleteElasticSearch */ >- [% IF ( Koha.Preference('OPACAutocompleteElasticSearch') ) %] >+ /* OPAC JS OPACAutocompleteElasticsearch */ >+ [% IF ( Koha.Preference('OPACAutocompleteElasticsearch') ) %] > AutocompleteInitOpac(); > [% END %] > }); >@@ -625,8 +625,8 @@ > } > $(this).parent().parent().remove(); > $('.search-term-row .search-term-input select[name="op"]').first().prop("disabled",true).hide(); >- /* OPAC JS OPACAutocompleteElasticSearch */ >- [% IF ( Koha.Preference('OPACAutocompleteElasticSearch') ) %] >+ /* OPAC JS OPACAutocompleteElasticsearch */ >+ [% IF ( Koha.Preference('OPACAutocompleteElasticsearch') ) %] > AutocompleteInitOpac(); > [% END %] > }); >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27113
:
114168
|
114169
|
114945
|
115117
|
116293
|
119979
|
120028
|
120029
|
120084
|
120088
|
120109
|
120140
|
120141
|
120806
|
121497
|
121498
|
121555
|
121556
|
121557
|
121558
|
131207
|
131208
|
131209
|
131210
|
131211
|
132360
|
132361
|
132362
|
132363
|
132364
|
132808
|
132945
|
132946
|
133042
|
133045
|
133407
|
133409
|
133410
|
136312
|
136456
|
136457
|
136464
|
136465
|
136653
|
136657
|
136658
|
136659
|
136660
|
137436
|
137437
|
137438
|
137439
|
137780
|
137781
|
137782
|
137783
|
139624
|
141466
|
145167
|
146015
|
159769
|
159770
|
159771
|
159772
|
159773
|
159774
|
159775
|
160134
|
160135
|
160136
|
160137
|
160138
|
160139
|
160140
|
160141
|
160142
|
161076
|
161077
|
163826
|
165895
|
165896
|
165897
|
165898
|
165899
|
165900
|
165901
|
165902
|
165903
|
165904
|
165913
|
165922
|
177537
|
177538
|
177539
|
177540
|
177541
|
177542
|
177543
|
177544
|
177545
|
177546
|
177547
|
177548
|
177657
|
178822
|
178823
|
178824
|
178825
|
178826
|
178827
|
178828
|
178829
|
178830
|
178831
|
178832
|
178833
|
179868
|
179869
|
179870
|
179871
|
179872
|
179873
|
179874
|
179875
|
179876
|
179877
|
179878
|
179879
| 185294