Bug 30985

Summary: Refine search doesn't work when item types contain same string (eg BK & BK-E)
Product: Koha Reporter: r-mcilwain <mcilwain>
Component: SearchingAssignee: Bugs List <koha-bugs>
Status: CLOSED INVALID QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low    
Version: 21.11   
Hardware: All   
OS: Linux   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description r-mcilwain 2022-06-17 12:09:17 UTC
When trying to a refine search for books only (no ebooks), I noticed nothing was happening; I was still geting all books AND ebooks. Upon further inspection I realized that the authorized values for books was BK and eBooks was BK-E. I realized that Koha was probably simply not being very strict when narrowing results by item type and was returning BK and BK-E because they both contained the string 'BK'.

I tested whether this was the case with other item types and didn't have an issue. I then tested by creating a new item type with authorized value EPUB and manually switched some BK-E records to the new item type (both 942$c and 952$y) and that resolved the issue.
Comment 1 Katrin Fischer 2022-06-17 13:18:38 UTC
That's because - is treated as a space. So the search for BK is ALSO a search for  BK E. This has been reported often, but is actually more of a configuration issue. It's recommended to not use spaces or hyphens in your itemtype, collection and location codes.