Bug 23035 - Intranet search is slow if thousands of items are in the biblios shown in the search results
Summary: Intranet search is slow if thousands of items are in the biblios shown in the...
Status: RESOLVED DUPLICATE of bug 28371
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Emmi Takkinen
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 15262
  Show dependency treegraph
 
Reported: 2019-06-03 15:28 UTC by Joonas Kylmälä
Modified: 2021-10-13 07:10 UTC (History)
5 users (show)

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


Attachments
Bug 23035: Use GetAuthorisedValues in transformMARCXML4XSLT (2.35 KB, patch)
2021-06-22 09:41 UTC, Emmi Takkinen
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Joonas Kylmälä 2019-06-03 15:28:47 UTC
If you search on intranet for biblios that have in total thousands of items then then the search result will load very very slowly. The slowing down is linear with the amount of items in the bibs.

I already tracked this down to a GetAuthorisedValueDesc() call in C4/XSLT.pm. I will start working on a patch for this.
Comment 1 Jonathan Druart 2019-11-14 11:15:55 UTC
A quick and (hopefully) efficient change would be to replace the SELECT from authorised_values by a call to C4::Koha::GetAuthorisedValues (the cache is used there).
Comment 2 Andrii Nugged 2019-11-14 11:21:15 UTC Comment hidden (obsolete)
Comment 3 Emmi Takkinen 2021-06-22 08:31:15 UTC
(In reply to Jonathan Druart from comment #1)
> A quick and (hopefully) efficient change would be to replace the SELECT from
> authorised_values by a call to C4::Koha::GetAuthorisedValues (the cache is
> used there).

This does indeed improve search speed quite a bit. Tested this in test environment where biblios usually have from ten to thousand items and in most cases search time was halved. 

I think this change along side with syspref introduced in bug 28373 would be a good start to make search work faster.
Comment 4 Emmi Takkinen 2021-06-22 09:41:13 UTC
Created attachment 122275 [details] [review]
Bug 23035: Use GetAuthorisedValues in transformMARCXML4XSLT

Intranet search is slow if thousands of items are in the biblios
shown in the search results. Using GetAuthorisedValues (which uses
cache) instead of GetAuthorisedValueDesc in transformMARCXML4XSLT
significantly speeds up search time.

To test:
1. Add biblio or biblios with hundreds/thousands items.
2. Tab F12 and select 'Network' to view time spent on search.
3. Perform search, note how long search takes to finnish.
4. Apply patch.
5. Repeat search.
=> Note that search should now work faster.

Also prove t/db_dependent/XSLT.t

Sponsored-by: Koha-Suomi Oy
Comment 5 Nick Clemens (kidclamp) 2021-08-25 15:44:19 UTC
GetAuthorisedValues returns an array, GetAuthorisedValueDesc returns a single value, so the patch needs a bit more.

To avoid caching/validation issues I proposed a solution on 28371 - can you take a look there?
Comment 6 Jonathan Druart 2021-10-13 07:10:56 UTC

*** This bug has been marked as a duplicate of bug 28371 ***