For example: .../cgi-bin/koha/opac-search.pl?tag=Important&q=Important "Availability: No items available:" appears for each result, even if there actually are items available. This is because the raw marc is being retrieved straight from the database without having any item data embedded in it... If you do a regular search, you will get the correct item availability. I assume this is because Koha adds the item information to the MARCXML before passing it to Zebra which returns the item data inside the raw MARC...
Created attachment 14967 [details] [review] Bug 9516 - Item Availability/Data missing from OPAC tag search Currently, an OPAC search using the "tag" and "q" query strings will have results with no item data. Next to "Availability", it will say "No items available:" (N.B. without reference to why the items are unavailable, like Checked out, In transit, etc.). The reason is that the opac-search.pl script is just pulling the marc blob straight from the database without embedding any item data. I've used the GetMarcBiblio sub with the embed item data option, and then converted the resulting Marc object to us marc using the "as_usmarc" method. --- To test: (Before patch) 1) Click on Tag cloud 2) Click on any of the tags 3) Note that all results say "Availability: No items available:" 4) Click on any result and note the actual status of the items for that biblio record (Apply patch) 1) Click on Tag cloud 2) Click on any of the tags 3) Note that the results actually have the correct item availability next to the "Availability" label.
Just another little note...make sure that the item availability information is actually correct for the items in your list. The data in my test system is a hodge-podge of backups, so I wasn't able to verify this one 100% (i.e. the item record says it's onloan, but there is no matching issue record, so it says checked out in the search results but available at the item level). Looking at the code, it should work, but doesn't hurt to keep a careful eye out.
Created attachment 15006 [details] [review] Bug 9516 - Item Availability/Data missing from OPAC tag search Currently, an OPAC search using the "tag" and "q" query strings will have results with no item data. Next to "Availability", it will say "No items available:" (N.B. without reference to why the items are unavailable, like Checked out, In transit, etc.). The reason is that the opac-search.pl script is just pulling the marc blob straight from the database without embedding any item data. I've used the GetMarcBiblio sub with the embed item data option, and then converted the resulting Marc object to us marc using the "as_usmarc" method. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Appears to work as advertised.
Neither I nor Owen have been able to reproduce this bug.
I should probably note that I forgot to test the pre-patch conditions before signing this patch. My bad!
(In reply to comment #4) > Neither I nor Owen have been able to reproduce this bug. Hmmm, intriguing! The more I look at the getRecords and searchResults subs, the more confused I get by the marc/marcxml/items synchronization. If it's working for you guys, it must mean that my sync is off, because using getRecords seems to return raw marc with embedded item data, while just querying the marc blob in the database returns raw marc without item data. :S I thought that the marcxml and marc weren't supposed to store item-level data anymore, but I don't see in these subs where it is being added. In fact, in searchResults (around line 1729: "Pull out the items fields"), it seems that the incoming marcRecord param passed into searchResults should have that embedded item data :S.
I think it may be a good idea to get at least a couple more people to test the preconditions for this bug. (In reply to comment #6) > (In reply to comment #4) > > Neither I nor Owen have been able to reproduce this bug. > > Hmmm, intriguing! > > The more I look at the getRecords and searchResults subs, the more confused > I get by the marc/marcxml/items synchronization. > > If it's working for you guys, it must mean that my sync is off, because > using getRecords seems to return raw marc with embedded item data, while > just querying the marc blob in the database returns raw marc without item > data. > > :S > > I thought that the marcxml and marc weren't supposed to store item-level > data anymore, but I don't see in these subs where it is being added. In > fact, in searchResults (around line 1729: "Pull out the items fields"), it > seems that the incoming marcRecord param passed into searchResults should > have that embedded item data :S.
I agree. I'm still not sure how it could've worked for you. When I connect to Zebra using yaz, I notice that the 952 field has been appended to the record, which is to be expected. When I look at the marc blob in the database, I don't see any 952 field, which is also to be expected. Since the GetBiblioData sub doesn't embed item data, I don't see how your your opac tag search results could possibly be getting item data :S. When you do the test, is your query string something along the lines of: ?tag=KEYWORD&q=KEYWORD Alas, I cannot test anything search related on my git dev install, as Zebra doesn't work on it. Wish I knew why... But when I try it on my actual trial install (3.8.0), it doesn't get any item data. I've looked at the code for master, and it looks like the same as 3.8.0 in this regard :S. (In reply to comment #7) > I think it may be a good idea to get at least a couple more people to test > the preconditions for this bug. > > (In reply to comment #6) > > (In reply to comment #4) > > > Neither I nor Owen have been able to reproduce this bug. > > > > Hmmm, intriguing! > > > > The more I look at the getRecords and searchResults subs, the more confused > > I get by the marc/marcxml/items synchronization. > > > > If it's working for you guys, it must mean that my sync is off, because > > using getRecords seems to return raw marc with embedded item data, while > > just querying the marc blob in the database returns raw marc without item > > data. > > > > :S > > > > I thought that the marcxml and marc weren't supposed to store item-level > > data anymore, but I don't see in these subs where it is being added. In > > fact, in searchResults (around line 1729: "Pull out the items fields"), it > > seems that the incoming marcRecord param passed into searchResults should > > have that embedded item data :S.