Bug 20919 - A Zebra query is done for each item when opening a record detail page
Summary: A Zebra query is done for each item when opening a record detail page
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff Client (show other bugs)
Version: unspecified
Hardware: All All
: P4 normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-12 14:31 UTC by Hugo Agud
Modified: 2018-08-02 15:36 UTC (History)
9 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 20919: Remove unecessary search calls on the biblio detail page (2.01 KB, patch)
2018-06-14 14:37 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20919: Remove unecessary search calls on the biblio detail page (2.04 KB, patch)
2018-06-15 08:01 UTC, Hugo Agud
Details | Diff | Splinter Review
Bug 20919: Remove unecessary search calls on the biblio detail page (2.16 KB, patch)
2018-07-11 14:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20919: Remove unecessary search calls on the biblio detail page (2.22 KB, patch)
2018-07-12 10:18 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Agud 2018-06-12 14:31:10 UTC
We have figured out that koha launch a zebra query for each item of a record, if the record have few items no problem, but if the record has hundreds of items, the time to display goes easily over 30 seconds.

we have checked on a fresh install on debian jessie 8 with koha 17.11.6 and 18.05

the file  zebra-output.log becomes huge

We have checked from intranet interface
Comment 1 Jonathan Druart 2018-06-14 14:37:59 UTC
Created attachment 76057 [details] [review]
Bug 20919: Remove unecessary search calls on the biblio detail page

There is a countanalytics flag that is set for items used in analytical
biblio records. This flag is only used in the template when 'analyze'
has been passed to the script.
In order to avoid unecessary search calls (1 per item), $analyse must be
tested.

Test plan:
0. Do not apply the patch
1. tail -f /var/log/koha/kohadev/zebra-output.log
2. Hit a bibliographic record detail page with several items
3. Notice that the log has 1 line per item:
  11:30:36-14/06 zebrasrv(32) [warn] ir_session (exception)
4. Apply the patch
5. Hit the page again
6. There is nothing in the zebra log file

If you are familiar with analytic records, confirm that you are not
allowed to remove an item that is used in analytical biblio records.
Comment 2 Hugo Agud 2018-06-15 08:01:16 UTC
Created attachment 76090 [details] [review]
Bug 20919: Remove unecessary search calls on the biblio detail page

There is a countanalytics flag that is set for items used in analytical
biblio records. This flag is only used in the template when 'analyze'
has been passed to the script.
In order to avoid unecessary search calls (1 per item), $analyse must be
tested.

Test plan:
0. Do not apply the patch
1. tail -f /var/log/koha/kohadev/zebra-output.log
2. Hit a bibliographic record detail page with several items
3. Notice that the log has 1 line per item:
  11:30:36-14/06 zebrasrv(32) [warn] ir_session (exception)
4. Apply the patch
5. Hit the page again
6. There is nothing in the zebra log file

If you are familiar with analytic records, confirm that you are not
allowed to remove an item that is used in analytical biblio records.

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 3 Jonathan Druart 2018-07-11 14:20:25 UTC
Created attachment 76862 [details] [review]
Bug 20919: Remove unecessary search calls on the biblio detail page

There is a countanalytics flag that is set for items used in analytical
biblio records. This flag is only used in the template when 'analyze'
has been passed to the script.
In order to avoid unecessary search calls (1 per item), $analyse must be
tested.

Test plan:
0. Do not apply the patch
1. tail -f /var/log/koha/kohadev/zebra-output.log
2. Hit a bibliographic record detail page with several items
3. Notice that the log has 1 line per item:
  11:30:36-14/06 zebrasrv(32) [warn] ir_session (exception)
4. Apply the patch
5. Hit the page again
6. There is nothing in the zebra log file

If you are familiar with analytic records, confirm that you are not
allowed to remove an item that is used in analytical biblio records.

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 4 Martin Renvoize 2018-07-12 10:18:19 UTC
Created attachment 76881 [details] [review]
Bug 20919: Remove unecessary search calls on the biblio detail page

There is a countanalytics flag that is set for items used in analytical
biblio records. This flag is only used in the template when 'analyze'
has been passed to the script.
In order to avoid unecessary search calls (1 per item), $analyse must be
tested.

Test plan:
0. Do not apply the patch
1. tail -f /var/log/koha/kohadev/zebra-output.log
2. Hit a bibliographic record detail page with several items
3. Notice that the log has 1 line per item:
  11:30:36-14/06 zebrasrv(32) [warn] ir_session (exception)
4. Apply the patch
5. Hit the page again
6. There is nothing in the zebra log file

If you are familiar with analytic records, confirm that you are not
allowed to remove an item that is used in analytical biblio records.

Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2018-07-12 10:18:59 UTC
Another fairly trivial but important improvement. All appears to work well and I can't find any regressions.

Passing QA
Comment 6 Nick Clemens 2018-07-13 11:25:15 UTC
Awesome work all!

Pushed to master for 18.11
Comment 7 Martin Renvoize 2018-07-15 19:04:27 UTC
Pushed to 18.05.x for 18.05.02
Comment 8 Fridolin SOMERS 2018-07-30 12:37:53 UTC
Pushed to 17.11.x for 17.11.09
Comment 9 Fridolin SOMERS 2018-07-30 12:38:14 UTC
Nice catch Hugo ;)