Bug 35192

Summary: Highlight search terms in OPAC Title notes tab
Product: Koha Reporter: Alex Buckley <alexbuckley>
Component: OPACAssignee: Alex Buckley <alexbuckley>
Status: Pushed to main --- QA Contact: Laura Escamilla <Laura.escamilla>
Severity: enhancement    
Priority: P5 - low CC: david, Laura.escamilla
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: Sponsored Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement highlights matching search terms in the OPAC record details page notes tab (when the OpacHighlightedWords system preference is set to 'Highlight').
Version(s) released in:
26.05.00
Circulation function:
Attachments: Bug 35192: Highlight search terms in the OPAC Title notes tab
Bug 35192: Highlight search terms in the OPAC Title notes tab
The search term 'fish' is highighted in the OPAC title notes tab in Google Chrome
Bug 35192: Highlight search terms in the OPAC Title notes tab
Bug 35192: Highlight search terms in the OPAC Title notes tab

Description Alex Buckley 2023-10-30 19:05:59 UTC
It would be nice if Koha could highlight the search term in the title notes tab of a OPAC biblio detail page.
Comment 1 Alex Buckley 2023-10-30 19:21:34 UTC
Created attachment 158101 [details] [review]
Bug 35192: Highlight search terms in the OPAC Title notes tab

Test plan:
1. Create a biblio record with the word 'Fish' in the title (245$a) and
the summary (520$a)
2. Set 'OpacHighlightedWords' system preference to 'Highlight'
3. Submit an OPAC search with the search term of 'Fish'. Click on the biblio created in #1
4. Notice 'Fish' in the title is highlighted, as is the Summary. Scroll
down to the Holdings table. Click on 'Title notes' and notice 'Fish' is
not highlighted in the 'Title notes'
5. Apply patch and restart services
6. Refresh the biblio page. Click on the 'Title notes' tab again
7. Notice 'Fish' is highlighted in the 'Title notes' tab
8. Right click, click 'Inspect element'. Confirm there are no JavaScript
errors in the console.

Sponsored-by: Catalyst IT, New Zealand
Comment 2 David Nind 2023-11-02 20:07:33 UTC
From my testing, words in the title notes tab are not highlighted.

The only JS error in the console is about downloadable fonts - there is a bug for this (Bug 34973).
Comment 3 Alex Buckley 2025-11-24 20:01:10 UTC
Created attachment 189918 [details] [review]
Bug 35192: Highlight search terms in the OPAC Title notes tab

Test plan:
1. Create a biblio record with the word 'Fish' in the title (245$a) and
the summary (520$a)
2. Set 'OpacHighlightedWords' system preference to 'Highlight'
3. Submit an OPAC search with the search term of 'Fish'. Click on the biblio created in #1
4. Notice 'Fish' in the title is highlighted, as is the Summary. Scroll
down to the Holdings table. Click on 'Title notes' and notice 'Fish' is
not highlighted in the 'Title notes'
5. Apply patch and restart services
6. Refresh the biblio page. Click on the 'Title notes' tab again
7. Notice 'Fish' is highlighted in the 'Title notes' tab
8. Right click, click 'Inspect element'. Confirm there are no JavaScript
errors in the console.

Sponsored-by: Catalyst IT, New Zealand
Comment 4 Alex Buckley 2025-11-24 20:01:58 UTC
Created attachment 189919 [details]
The search term 'fish' is highighted in the OPAC title notes tab in Google Chrome
Comment 5 Alex Buckley 2025-11-24 20:04:06 UTC
(In reply to David Nind from comment #2)
> From my testing, words in the title notes tab are not highlighted.
> 
> The only JS error in the console is about downloadable fonts - there is a
> bug for this (Bug 34973).

Hi David, 

It was lovely to see you last week at Kohacon!!

I've reworked this fix and have tested on main in Google Chrome and Mozilla Firefox. Could you please re-test when you have a moment and let me know if the test problems you found in comment #2 are now resolved?

Many thanks,
Alex
Comment 6 David Nind 2025-11-28 03:26:25 UTC
Created attachment 190001 [details] [review]
Bug 35192: Highlight search terms in the OPAC Title notes tab

Test plan:
1. Create a biblio record with the word 'Fish' in the title (245$a) and
the summary (520$a)
2. Set 'OpacHighlightedWords' system preference to 'Highlight'
3. Submit an OPAC search with the search term of 'Fish'. Click on the biblio created in #1
4. Notice 'Fish' in the title is highlighted, as is the Summary. Scroll
down to the Holdings table. Click on 'Title notes' and notice 'Fish' is
not highlighted in the 'Title notes'
5. Apply patch and restart services
6. Refresh the biblio page. Click on the 'Title notes' tab again
7. Notice 'Fish' is highlighted in the 'Title notes' tab
8. Right click, click 'Inspect element'. Confirm there are no JavaScript
errors in the console.

Sponsored-by: Catalyst IT, New Zealand
Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Laura Escamilla 2025-12-23 12:33:51 UTC
Created attachment 190691 [details] [review]
Bug 35192: Highlight search terms in the OPAC Title notes tab

Test plan:
1. Create a biblio record with the word 'Fish' in the title (245$a) and
the summary (520$a)
2. Set 'OpacHighlightedWords' system preference to 'Highlight'
3. Submit an OPAC search with the search term of 'Fish'. Click on the biblio created in #1
4. Notice 'Fish' in the title is highlighted, as is the Summary. Scroll
down to the Holdings table. Click on 'Title notes' and notice 'Fish' is
not highlighted in the 'Title notes'
5. Apply patch and restart services
6. Refresh the biblio page. Click on the 'Title notes' tab again
7. Notice 'Fish' is highlighted in the 'Title notes' tab
8. Right click, click 'Inspect element'. Confirm there are no JavaScript
errors in the console.

Sponsored-by: Catalyst IT, New Zealand
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 8 Lucas Gass (lukeg) 2025-12-30 14:51:24 UTC
Nice work everyone!

Pushed to main for 26.05