Bug 28808

Summary: Item search should allow wildcard in subfield when setting up custom search option
Product: Koha Reporter: Andrew Fuerste-Henry <andrew>
Component: SearchingAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Andrew Fuerste-Henry 2021-08-03 17:40:26 UTC
When querying a MARC record via SQL directly, one can wildcard the subfield to search an entire MARC tag -- like "ExtractValue(metadata,'//datafield[@tag="650"]/*')" to look at the whole 650 without specifying a subfield.

It would be nice to be able to select "*" for one's subfield when setting up a custom item search field. As is, you have to either leave it blank (which will break all searches) or pick a specific value.
Comment 1 Nick Clemens (kidclamp) 2021-08-03 18:08:03 UTC
Currently the code is something like:
ExtractValue(metadata,'//record/datafield[@tag="XXX"]/subfield[@code="Y"]') LIKE 'TERM'

If we defaulted to a contains search we could implement as:
SELECT ExtractValue(metadata,'//datafield[@tag="XXX"]/subfield[@code="Y" AND contains(.,"TERM")]')