At the moment, if you do a search in the OPAC or staff client for "itemnumber:1", you'll get no results even when you have an item with an itemnumber of 1. That's because Zebra defaults to a word list search, but there is no word index for itemnumber. It's a numeric index. So, to find that item, you'll have to try "itemnumber,st-numeric:1". However, by tweaking ccl.properties, we can make "itemnumber:1" work as well. We already do this for "notforloan" which we know will always be numeric. Current ccl.properties: notforloan 1=8008 4=109 itemnumber 1=8010 4=109 is the PQF/RPN for "st-numeric". So... let's just add "4=109" to itemnumber, and be merry!
Created attachment 38223 [details] [review] Bug 14031 - Itemnumber should be a numeric search in ccl.properties This patch changes the "itemnumber" alias so that it acts like "itemnumber,st-numeric". That is, it always does a numeric search. _TEST PLAN_ The best way to test this patch is to apply the patch and then run "make upgrade", I suspect. As this will refresh your "ccl.properties". However, this patch is actually really small, so you can just apply it manually to an existing "ccl.properties" if you rather save time. Basically, you just need to do the following steps: 0) Do a search for "itemnumber:<insert real indexed itemnumber here>" 1) Note that you can't retrieve any results 2) Change your ccl.properties to say "itemnumber 1=8010 4=109" 3) Repeat the search for "itemnumber:<X>" 4) Note that you now retrieve your result
Created attachment 39897 [details] [review] Bug 14031 - Itemnumber should be a numeric search in ccl.properties This patch changes the "itemnumber" alias so that it acts like "itemnumber,st-numeric". That is, it always does a numeric search. _TEST PLAN_ The best way to test this patch is to apply the patch and then run "make upgrade", I suspect. As this will refresh your "ccl.properties". However, this patch is actually really small, so you can just apply it manually to an existing "ccl.properties" if you rather save time. Basically, you just need to do the following steps: 0) Do a search for "itemnumber:<insert real indexed itemnumber here>" 1) Note that you can't retrieve any results 2) Change your ccl.properties to say "itemnumber 1=8010 4=109" 3) Repeat the search for "itemnumber:<X>" 4) Note that you now retrieve your result Signed-off-by: Magnus Enger <magnus@libriotech.no> Tested on a gitified package install. Made the change to /etc/koha/zebradb/ccl.properties manually. After this change I can successfully search for "itemnumber:1".
It does not work for UNIMARC, the itemnumber is not indexed.
Shouldn't we do the same for the biblionumber?
(In reply to Jonathan Druart from comment #3) > It does not work for UNIMARC, the itemnumber is not indexed. In that case, perhaps I should amend the name of the bug to be MARC21/NORMARC specific? Do you want itemnumber to be indexed in UNIMARC?
(In reply to Jonathan Druart from comment #4) > Shouldn't we do the same for the biblionumber? "biblionumber" isn't indexed in MARC21, although the biblionumber is indexed as "local-number" in MARC21. It's indexed as "numeric" and "word" though, so I haven't encountered this problem with it before. I suppose it might be worthwhile having a larger discussion about what indexes should exist and how we index them... (as numeric, word, phrase, etc)
(In reply to David Cook from comment #5) > (In reply to Jonathan Druart from comment #3) > > It does not work for UNIMARC, the itemnumber is not indexed. > > In that case, perhaps I should amend the name of the bug to be > MARC21/NORMARC specific? > > Do you want itemnumber to be indexed in UNIMARC? Ccing Fridolin as a Zebra and UNIMARC expert :)
(In reply to Jonathan Druart from comment #7) > (In reply to David Cook from comment #5) > > (In reply to Jonathan Druart from comment #3) > > > It does not work for UNIMARC, the itemnumber is not indexed. > > > > In that case, perhaps I should amend the name of the bug to be > > MARC21/NORMARC specific? > > > > Do you want itemnumber to be indexed in UNIMARC? > > Ccing Fridolin as a Zebra and UNIMARC expert :) No lib as never asked for it I think. I'd say keep it not indexed. Note that using numeric search is only useful when using comparisons greater or lower than. Default search is phrase so indexing itemnumber subfield as phrase should be enough to allow searching : "itemnumber:9999"
(In reply to Fridolin SOMERS from comment #8) > Note that using numeric search is only useful when using comparisons greater > or lower than. That's probably a valid point. We could probably add itemnumber to a non-numeric index for MARC21, although then we're indexing it twice when we could just index it once and change the CCL alias instead. > Default search is phrase so indexing itemnumber subfield as phrase should be > enough to allow searching : "itemnumber:9999" I believe the default search is actually wordlist (:w), but that's true enough. In MARC21, the biblionumber is indexed like so: "Local-Number:n Local-Number:w Local-Number:s". So "local-number:9999" will get you the biblionumber stored in the local-number "w" index. The ":s" is probably unnecessary as that's just for sorting...
Created attachment 41382 [details] [review] Bug 14031 - Itemnumber should be a numeric search in ccl.properties This patch changes the "itemnumber" alias so that it acts like "itemnumber,st-numeric". That is, it always does a numeric search. _TEST PLAN_ The best way to test this patch is to apply the patch and then run "make upgrade", I suspect. As this will refresh your "ccl.properties". However, this patch is actually really small, so you can just apply it manually to an existing "ccl.properties" if you rather save time. Basically, you just need to do the following steps: 0) Do a search for "itemnumber:<insert real indexed itemnumber here>" 1) Note that you can't retrieve any results 2) Change your ccl.properties to say "itemnumber 1=8010 4=109" 3) Repeat the search for "itemnumber:<X>" 4) Note that you now retrieve your result Signed-off-by: Magnus Enger <magnus@libriotech.no> Tested on a gitified package install. Made the change to /etc/koha/zebradb/ccl.properties manually. After this change I can successfully search for "itemnumber:1". Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Patch pushed to master. Thanks David!