Bug 27428 - Show the number of records in the bibliographic record detail page with ElasticSearch
Summary: Show the number of records in the bibliographic record detail page with Elast...
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Ivan Dziuba
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-13 18:17 UTC by Ivan Dziuba
Modified: 2024-04-09 13:31 UTC (History)
12 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (10.70 KB, patch)
2021-01-14 13:26 UTC, Ivan Dziuba
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.24 KB, patch)
2021-01-15 14:50 UTC, Ivan Dziuba
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.27 KB, patch)
2021-03-08 23:40 UTC, Ivan Dziuba
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.31 KB, patch)
2021-04-21 21:49 UTC, Ivan Dziuba
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.21 KB, patch)
2021-04-22 22:24 UTC, Ivan Dziuba
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.30 KB, patch)
2021-05-06 13:44 UTC, Lund University Sandbox
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (10.98 KB, patch)
2022-03-23 17:36 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.37 KB, patch)
2022-08-22 19:34 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.38 KB, patch)
2022-08-22 19:46 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.09 KB, patch)
2022-08-23 14:23 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.14 KB, patch)
2023-01-11 21:07 UTC, solene.ngamga
Details | Diff | Splinter Review
Bug 27428: (QA follow-up) Add missing POD, remove ES template literals in opac-display-record-count.js (2.23 KB, patch)
2023-03-28 16:33 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.19 KB, patch)
2023-08-17 09:36 UTC, Peter Vashchuk
Details | Diff | Splinter Review
Bug 27428: (QA follow-up) Add missing POD, remove ES template literals in opac-display-record-count.js (2.29 KB, patch)
2023-08-17 09:36 UTC, Peter Vashchuk
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.21 KB, patch)
2023-11-08 01:23 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 27428: (QA follow-up) Add missing POD, remove ES template literals in opac-display-record-count.js (1.57 KB, patch)
2023-11-08 01:23 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 27428: (follow-up) perltidy, change the atomic file to the newer format, moving system preference to Features section and Fixing opac-display-record-count.js (10.91 KB, patch)
2023-11-08 01:23 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 27428: (follow-up) Fix Session (980 bytes, patch)
2024-01-24 15:33 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch. (11.21 KB, patch)
2024-04-09 13:31 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 27428: (QA follow-up) Add missing POD, remove ES template literals in opac-display-record-count.js (1.57 KB, patch)
2024-04-09 13:31 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 27428: (follow-up) perltidy, change the atomic file to the newer format, moving system preference to Features section and Fixing opac-display-record-count.js (9.29 KB, patch)
2024-04-09 13:31 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 27428: (follow-up) Fix Session (980 bytes, patch)
2024-04-09 13:31 UTC, Hammat wele
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Dziuba 2021-01-13 18:17:46 UTC
This preference only for OPAC to show the number of records next to search links in the bibliographic record detail page.
Comment 1 Ivan Dziuba 2021-01-14 13:26:51 UTC Comment hidden (obsolete)
Comment 2 Ivan Dziuba 2021-01-15 14:50:16 UTC Comment hidden (obsolete)
Comment 3 Frank Hansen 2021-02-25 15:43:39 UTC
I have applied the patch but I can't get it to work. Maybe I misunderstand how it is supposed to work. Can you clarify what it should look like, maybe post a screen shots?
Comment 4 Owen Leonard 2021-02-25 16:05:26 UTC
I see an error in the console:

Could not compile /kohadevbox/koha/opac/svc/elasticsearch/opac-autocomplete.pl: Can't locate Switch.pm in @INC (you may need to install the Switch module)
Comment 5 Timothy Alexis Vass 2021-03-04 13:19:08 UTC
I see this line in the patch for opac/svc/elasticsearch/opac-autocomplete.pl:
8 use Switch;

But it doesn't seem to be used in the code?
There seems to be other modules used which aren't used either.
Comment 6 Timothy Alexis Vass 2021-03-04 13:21:20 UTC
Sorry, the Switch module is the only one which isn't actually used in the code.

There are no switch or case statements.
Comment 7 Björn Nylén 2021-03-04 14:31:53 UTC
I recall dependency on Text::Unaccent was recently removed by Bug 14759, replaced by Unicode::Normalize. We shouldn't ad it back in, perhaps.
Comment 8 Ivan Dziuba 2021-03-08 23:40:26 UTC Comment hidden (obsolete)
Comment 9 Séverine Queune 2021-03-11 13:35:45 UTC
(In reply to Frank Hansen from comment #3)
> I have applied the patch but I can't get it to work. Maybe I misunderstand
> how it is supposed to work. Can you clarify what it should look like, maybe
> post a screen shots?

Same as Franck, I don't see differents in bib record page when I enable the syspref. It seems I misunderstood something too.
Comment 10 Ivan Dziuba 2021-04-21 21:49:38 UTC
Created attachment 119980 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.

Bug 27113: ElasticSearch: Autocomplete in input search. Use Unicode::Normalize instead Text::Unaccent.
Comment 11 Owen Leonard 2021-04-22 13:03:40 UTC
This patch includes elasticsearch/opac-autocomplete.pl. Does that change belong here?
Comment 12 Blou 2021-04-22 13:23:49 UTC
That shoudl be opac-elasticsearch.pl (or similar generic name) in here and Bug 27113
Comment 13 Ivan Dziuba 2021-04-22 22:24:20 UTC
Created attachment 120034 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.
Comment 14 Lund University Sandbox 2021-05-06 13:44:10 UTC
Created attachment 120633 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Comment 15 Stina Hallin 2021-05-06 13:46:35 UTC
The number of records did show, but some of the search words got the number 0, and that is obviously wrong. See:
Subject(s): Clans -- Scotland -- Great Glen -- History -- 17th century [1] | Clans -- Scotland -- Great Glen -- History -- 18th century [1] | Jacobites [2] | Great Glen (Scotland) -- History [1] | Highlands (Scotland) -- History [0] | Scotland -- History -- 17th century [1] | Scotland -- History -- 18th century [0]
From opac-detail.pl?biblionumber=60.
Comment 16 Marcel de Rooy 2021-07-09 08:43:40 UTC
(In reply to Stina Hallin from comment #15)
> The number of records did show, but some of the search words got the number
> 0, and that is obviously wrong. See:
> Subject(s): Clans -- Scotland -- Great Glen -- History -- 17th century [1] |
> Clans -- Scotland -- Great Glen -- History -- 18th century [1] | Jacobites
> [2] | Great Glen (Scotland) -- History [1] | Highlands (Scotland) -- History
> [0] | Scotland -- History -- 17th century [1] | Scotland -- History -- 18th
> century [0]
> From opac-detail.pl?biblionumber=60.

Stina, if you find things that are obviously wrong, you may change the status of the patch to Failed QA.
Comment 17 Marcel de Rooy 2021-07-09 08:45:10 UTC
+('OPACDisplayRecordCount','0',NULL,NULL,'YesNo')

Please add description here
Comment 18 Marcel de Rooy 2021-07-09 08:46:34 UTC
+              default: no
+              choices:
+                  1: Show
+                  0: "Don't show"

You probably mean default 0 ?
Comment 19 Shi Yao Wang 2022-03-23 17:36:48 UTC
Created attachment 132068 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Comment 20 Séverine Queune 2022-03-30 15:57:04 UTC
Ok, I got it now !
It works nice :)

I've got few questions though before signing it.

I wonder what is the perimeter of the application : does the feature applied for every search link available in the record ?

I saw that some special signs are not taken into account in the search but some are kept such like ';' or ':'. Is it a specific reason for that, for I don't get the logic ?

This special signs can lead to unsuccessful searches so, for some records with a lot of informations, I wonder if, in the case result is [0], it's useful to display the information (see screenshot https://snipboard.io/RvlewS.jpg)
Comment 21 Shi Yao Wang 2022-08-22 19:34:32 UTC
Created attachment 139625 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Comment 22 Shi Yao Wang 2022-08-22 19:46:25 UTC
Created attachment 139626 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Comment 23 Shi Yao Wang 2022-08-23 14:23:17 UTC
Created attachment 139681 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Comment 24 solene.ngamga 2023-01-11 21:07:15 UTC
Created attachment 145222 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>
Comment 25 Marcel de Rooy 2023-02-24 10:56:55 UTC
 FAIL   Koha/SearchEngine/Elasticsearch/Browse.pm
   OK     critic
   OK     forbidden patterns
   OK     git manipulation
   OK     pod
   FAIL   pod coverage
                POD is missing for 'count_record'
   SKIP   spelling
   OK     valid

 OK     installer/data/mysql/mandatory/sysprefs.sql
   OK     git manipulation
   OK     semicolon
   OK     sysprefs_order

 FAIL   koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
   FAIL   filters
                asset_must_be_raw at line 52 (    [% Asset.js("js/opac-display-record-count.js") %])
   OK     forbidden patterns
   OK     git manipulation
   OK     js_in_body
   SKIP   spelling
   OK     tt_valid
   OK     valid_template

 OK     koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
   OK     filters
   OK     forbidden patterns
   OK     git manipulation
   OK     js_in_body
   SKIP   spelling
   OK     tt_valid
   OK     valid_template

 FAIL   koha-tmpl/opac-tmpl/bootstrap/js/opac-display-record-count.js
   FAIL   ES template literals
                ES template literals found (    var regex = `a[href*="${regex_es_link}"]`;) - See bug 24725
Comment 26 Hammat wele 2023-03-28 16:33:33 UTC
Created attachment 148842 [details] [review]
Bug 27428: (QA follow-up) Add missing POD, remove ES template literals in opac-display-record-count.js
Comment 27 Peter Vashchuk 2023-08-17 09:36:00 UTC
Created attachment 154509 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Comment 28 Peter Vashchuk 2023-08-17 09:36:03 UTC
Created attachment 154510 [details] [review]
Bug 27428: (QA follow-up) Add missing POD, remove ES template literals in opac-display-record-count.js

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Comment 29 Katrin Fischer 2023-10-14 20:25:55 UTC
Hi, this is a really interesting feature!

Some notes:

1) The QA test tools are currently still failing, but it's only a perltidy that is needed.

2) The database update still has the old format and should be moved to the newer atomic update template.

3) The system preference is added correctly, but should
a) Include a note that this feature is "Elasticsearch only"
b) Be moved to the "Features" section instead of the "Did you mean" where it appears now.

4) It didn't work in my testing :( Maybe something broke with changes made to the OPAC since this was submitted the first time?

* I used ktd --es7 up
* Made sure SearchEngine was Elasticsearch and search worked
* Applied patch
* restart_all
* Turned on OPACDisplayRecordCount system preference

I don't see any errors in the console, but the JSON responses come back empty, possibly because the q param is empty::

http://localhost:8080/cgi-bin/koha/svc/elasticsearch/opac-elasticsearch.pl?q=[]&key=nb_notice ?

I searched for "perl" in a MARC21 sample database and paged through a lot of the results with no counts showing.

5) Code review
* Please translate code comments if you want to keep them:
+/* Regex pour tous les URL avec un recherche */

This uses the older /svc pattern, we might want to get a second more technical review on this one.
Comment 30 Hammat wele 2023-11-08 01:23:17 UTC
Created attachment 158639 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Comment 31 Hammat wele 2023-11-08 01:23:21 UTC
Created attachment 158640 [details] [review]
Bug 27428: (QA follow-up) Add missing POD, remove ES template literals in opac-display-record-count.js

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Comment 32 Hammat wele 2023-11-08 01:23:26 UTC
Created attachment 158641 [details] [review]
Bug 27428: (follow-up) perltidy, change the atomic file to the newer format, moving system preference to Features section and Fixing opac-display-record-count.js
Comment 33 Hammat wele 2024-01-24 15:33:48 UTC
Created attachment 161349 [details] [review]
Bug 27428: (follow-up) Fix Session
Comment 34 Hammat wele 2024-04-09 13:31:02 UTC
Created attachment 164557 [details] [review]
Bug 27428: Show the number of records in the bibliographic record detail page with ElasticSearch.

Tests:
1. Apply this patch;
2. In the Preference system - OPACDisplayRecordCount -> Show;
3. We can see the number of records next to search links in the bibliographic record detail page in the OPAC.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Comment 35 Hammat wele 2024-04-09 13:31:06 UTC
Created attachment 164558 [details] [review]
Bug 27428: (QA follow-up) Add missing POD, remove ES template literals in opac-display-record-count.js

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Comment 36 Hammat wele 2024-04-09 13:31:10 UTC
Created attachment 164559 [details] [review]
Bug 27428: (follow-up) perltidy, change the atomic file to the newer format, moving system preference to Features section and Fixing opac-display-record-count.js
Comment 37 Hammat wele 2024-04-09 13:31:14 UTC
Created attachment 164560 [details] [review]
Bug 27428: (follow-up) Fix Session