Bug 38846 - Function getLanguages is called unnecessarily for search result pages
Summary: Function getLanguages is called unnecessarily for search result pages
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: David Cook
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-08 00:11 UTC by David Cook
Modified: 2025-01-31 18:47 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes OPAC and staff interface searching so that language option functions (C4::Languages::getLanguages) are only used on the advanced search pages and not the search result pages, where the output is not used. This should also help improve performance - this might be minor on a quiet system, but it could have an impact on a busier system (and reduces unnecessary database calls).
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 38846: Only call getLanguages for advanced search pages (2.80 KB, patch)
2025-01-08 00:40 UTC, David Cook
Details | Diff | Splinter Review
Bug 38846: Only call getLanguages for advanced search pages (2.87 KB, patch)
2025-01-08 13:54 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2025-01-08 00:11:53 UTC
The output of getLanguages() is only used in the advanced search page and not in search results, so it should only be called for the former action.

As per comments on bug 16734 and bug 38646, the performance difference is minor on a quiet system, but it could have an impact on a busier system, and it's always good to cut down on unnecessary database calls where possible.
Comment 1 David Cook 2025-01-08 00:40:50 UTC
Created attachment 176213 [details] [review]
Bug 38846: Only call getLanguages for advanced search pages

This change makes it so that C4::Languages::getLanguages is only
called for the advanced search pages and not the search result pages
where the output is not used.

Test plan:
0. Apply the patch and koha-plack --restart kohadev
1. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?expanded_options=1
2. Note that the "Language" and "Language of original" dropdowns appear with language
options
3. Go to the following
http://localhost:8081/cgi-bin/koha/catalogue/search.pl?advsearch=1
&idx=kw&q=test&sort_by=relevance
4. Note that the page loads normally

5. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?expanded_options=1
6. Note that the "Language" dropdown appears with language options
7. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1
8. Note that the page loads normally
Comment 2 Martin Renvoize (ashimema) 2025-01-08 13:54:41 UTC
Created attachment 176236 [details] [review]
Bug 38846: Only call getLanguages for advanced search pages

This change makes it so that C4::Languages::getLanguages is only
called for the advanced search pages and not the search result pages
where the output is not used.

Test plan:
0. Apply the patch and koha-plack --restart kohadev
1. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?expanded_options=1
2. Note that the "Language" and "Language of original" dropdowns appear with language
options
3. Go to the following
http://localhost:8081/cgi-bin/koha/catalogue/search.pl?advsearch=1
&idx=kw&q=test&sort_by=relevance
4. Note that the page loads normally

5. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?expanded_options=1
6. Note that the "Language" dropdown appears with language options
7. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1
8. Note that the page loads normally

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Katrin Fischer 2025-01-10 18:21:22 UTC
Pushed for 25.05!

Well done everyone, thank you!