Bug 30249 - Search limit by itemtype fails when itemtype codes are too similar
Summary: Search limit by itemtype fails when itemtype codes are too similar
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-08 20:11 UTC by Andrew Fuerste-Henry
Modified: 2022-03-10 22:08 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2022-03-08 20:11:36 UTC
To recreate:
- create itemtypes BK, EBK, and E-BK
- catalog one bib in each itemtype, all with the same title
- perform a search for that title, see all 3 bibs in your results and all 3 itemtypes in your facets
- limit your search to just the BK itemtype
- confirm both the BK and E-BK records still show in your results but the EBK record does not

Somewhere in the execution of this search, we're failing to properly parse "E-BK" as distinct from "BK."
Comment 1 Andrew Fuerste-Henry 2022-03-08 20:12:53 UTC
Confirmed this behavior with both Zebra and ES.
Comment 2 David Cook 2022-03-08 22:31:32 UTC
This is just an educated guess, but "E-BK" is probably being normalized as "E BK" and then tokenized into "E" and "BK".

I don't know about ES but I'm confident Zebra doesn't have any way to avoid normalization/tokenization for selective indexes.

I'd say the solution would be to try to avoid allowing itemtypes that can be normalized/tokenized to be the same, but that won't help with data migrations. I suppose it could be yet another check in about.pl...
Comment 3 Katrin Fischer 2022-03-08 22:52:47 UTC
Hi Andrew, 

I think this has been filed several times already and David is right.
The - is treated like a space and so BK will also find E-BK because it contains the same word.

We always recommend not using - or _ or spaces in itemtype codes and authorised values used in bibliographic or item records for that reason. 

There is no really a good fix I think. Exact filed search with ,ext could be an option but not sure how that translates to ES and at least some older Zebra versions didn't support ext with ICU (I am not even sure it works now).
Comment 4 Andrew Fuerste-Henry 2022-03-09 13:41:56 UTC
> I'd say the solution would be to try to avoid allowing itemtypes that can be
> normalized/tokenized to be the same, but that won't help with data
> migrations. I suppose it could be yet another check in about.pl...

Thanks, David and Katrin. I knew I'd run into this before, but couldn't remember seeing a bug about it.

If we know these characters cause problems when used in itemtype codes, then I'd be inclined to somehow not permit their use, but I don't have a solution for keeping that tidy in migration.

If we don't block these characters, then some sort of warning text might be helpful, but I'm not sure where we'd put it that users would actually see and respect.
Comment 5 Katrin Fischer 2022-03-09 15:55:13 UTC
I have to admit I kind of made use of that in the fact to create a "group search" for locations and collections. A warning might be nicer than a hard block and also some documentation on the manual.
Comment 6 David Cook 2022-03-09 22:39:55 UTC
I suppose it's rarely a priority for me, as it's something that isn't too difficult to fix up on the backend manually for a sysadmin...
Comment 7 David Cook 2022-03-09 22:40:24 UTC
(In reply to Katrin Fischer from comment #5)
> I have to admit I kind of made use of that in the fact to create a "group
> search" for locations and collections. 

That's interesting. Could you talk more about that?
Comment 8 Katrin Fischer 2022-03-10 22:07:27 UTC
I think the use case was something like items in several rooms/areas outside the library. So what you could do is use a common prefix and number then like:

loc-1
loc-2
loc-3

etc.

then you can find them all searching for location:loc and individually using location:loc 1
Comment 9 Katrin Fischer 2022-03-10 22:08:13 UTC
We do have a grouping feature for itemtypes - so more useful for locations and collections.