Bug 42107

Summary: Add score to staff search results
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Searching - ElasticsearchAssignee: Nick Clemens (kidclamp) <nick>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40853
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Crowdfunding committed: 0
Crowdfunding contact: Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 42107: Add search scores to staff results page

Description Nick Clemens (kidclamp) 2026-03-16 12:57:09 UTC
When changing search settings in ES it would be helpful to understand how the current results are being scored.
Comment 1 Nick Clemens (kidclamp) 2026-03-16 13:01:14 UTC
Created attachment 195476 [details] [review]
Bug 42107: Add search scores to staff results page

This patch ensures the scores from ES are passed through and added to the
search results in the staff side.

Initially hidden, the scores can be shown by entering the line below into the
JS console in developer tools in the browser, or added to IntranetUserJS to
make them always show:
$(".search_score").toggle();

To test:
1 - Have Koha using ES
2 - Do some searches, note results
3 - Apply patch, restart all
4 - Confirm results don't change
5 - Enter code from description into IntranetUserJS
6 - Do more searches
7 - Note the score is visible

To really note scores, you will need to add some weights to the ES config:
Set weights like:
title 32
author 16
subject 8