Bug 31881

Summary: Link in MARC view does not work
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: CatalogingAssignee: Fridolin Somers <fridolin.somers>
Status: RESOLVED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, lucas, m.de.rooy, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.09, 21.11.16
Attachments: Bug 31881: Fix search link in MARC view
Bug 31881: Fix search link in MARC view
Bug 31881: Fix search link in MARC view

Description Fridolin Somers 2022-10-19 21:25:54 UTC
In framework a subfield can be defined with a link (with a search field).
This create an hyperlink in MARC view.
Currently the link does not work because search query contains 'field,phr:', which is useless since the link contains 'idx=field,phr'
Comment 1 Fridolin Somers 2022-10-20 01:03:41 UTC
Created attachment 142219 [details] [review]
Bug 31881: Fix search link in MARC view

In framework a subfield can be defined with a link (with a search field).
This create an hyperlink in MARC view.
Currently with Elasticsearch the link does not work because search query contains 'field,phr:',
which is useless since the link contains 'idx=field,phr'.
With Zebra looks like the idx param is ignored.

Test plan :
1) Use Elasticsearch search engine
2) Edit subfield 245$a in default framework
3) Enter 'title' in 'Link'
4) Save
5) Create a record with default framework with 245$a = 'The Fifth Elephant'
6) Go to MARC view
7) Click on link in 245$a
8) You find the record
Comment 2 David Nind 2022-10-20 13:42:58 UTC
Created attachment 142246 [details] [review]
Bug 31881: Fix search link in MARC view

In framework a subfield can be defined with a link (with a search field).
This create an hyperlink in MARC view.
Currently with Elasticsearch the link does not work because search query contains 'field,phr:',
which is useless since the link contains 'idx=field,phr'.
With Zebra looks like the idx param is ignored.

Test plan :
1) Use Elasticsearch search engine
2) Edit subfield 245$a in default framework
3) Enter 'title' in 'Link'
4) Save
5) Create a record with default framework with 245$a = 'The Fifth Elephant'
6) Go to MARC view
7) Click on link in 245$a
8) You find the record

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Marcel de Rooy 2022-10-21 07:19:21 UTC
Not created here, but how ugly is this:
[% IF ( subfiel.link ) %]

subfiel ??
Comment 4 Marcel de Rooy 2022-10-21 07:28:11 UTC
Currently with Elasticsearch the link does not work because search query contains 'field,phr:',
which is useless since the link contains 'idx=field,phr'.

Not sure about this one. Are we really resolving the problem or just creating a workaround?

You say that the query contains 'field'. Isnt that just misconfiguration? The framework column link should contain a valid index?

Please clarify.
Comment 5 Fridolin Somers 2022-10-21 19:27:45 UTC
(In reply to Marcel de Rooy from comment #4)
> Currently with Elasticsearch the link does not work because search query
> contains 'field,phr:',
> which is useless since the link contains 'idx=field,phr'.
> 
> Not sure about this one. Are we really resolving the problem or just
> creating a workaround?
> 
> You say that the query contains 'field'. Isnt that just misconfiguration?
> The framework column link should contain a valid index?
> 
> Please clarify.

Sure.

In test plan, framework column link contains 'title' which is a valid 'index' (= search field).
Actually the build search link contains the search field twice :
&idx=title,phr
&q=title,phr:...

I think we want to build a search query like it as been created from advanced search. So keep '&idx' and remove search field from '&q'.
Comment 6 Marcel de Rooy 2022-11-04 10:23:19 UTC
Created attachment 143174 [details] [review]
Bug 31881: Fix search link in MARC view

In framework a subfield can be defined with a link (with a search field).
This create an hyperlink in MARC view.
Currently with Elasticsearch the link does not work because search query contains 'field,phr:',
which is useless since the link contains 'idx=field,phr'.
With Zebra looks like the idx param is ignored.

Test plan :
1) Use Elasticsearch search engine
2) Edit subfield 245$a in default framework
3) Enter 'title' in 'Link'
4) Save
5) Create a record with default framework with 245$a = 'The Fifth Elephant'
6) Go to MARC view
7) Click on link in 245$a
8) You find the record

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Marcel de Rooy 2022-11-04 10:23:56 UTC
(In reply to Fridolin Somers from comment #5)
> I think we want to build a search query like it as been created from
> advanced search. So keep '&idx' and remove search field from '&q'.

Great. Thanks.
Comment 8 Tomás Cohen Arazi 2022-11-04 22:14:31 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 9 Lucas Gass 2023-01-18 21:10:03 UTC
Backported to 22.05.x for upcoming 22.05.09
Comment 10 Arthur Suzuki 2023-01-26 09:46:33 UTC
pushed to 21.11.x for 21.11.16
Comment 11 wainuiwitikapark 2023-03-15 01:27:41 UTC
Not backported to 21.05.x