Bug 9516 - Item Availability/Data missing from OPAC tag search
Summary: Item Availability/Data missing from OPAC tag search
Status: CLOSED WORKSFORME
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: David Cook
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-30 23:07 UTC by David Cook
Modified: 2014-12-07 20:02 UTC (History)
1 user (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
Bug 9516 - Item Availability/Data missing from OPAC tag search (2.14 KB, patch)
2013-01-31 00:29 UTC, David Cook
Details | Diff | Splinter Review
Bug 9516 - Item Availability/Data missing from OPAC tag search (1.80 KB, patch)
2013-02-01 13:47 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2013-01-30 23:07:01 UTC
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...
Comment 1 David Cook 2013-01-31 00:29:27 UTC Comment hidden (obsolete)
Comment 2 David Cook 2013-01-31 02:44:12 UTC
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.
Comment 3 Kyle M Hall (khall) 2013-02-01 13:47:55 UTC
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.
Comment 4 Kyle M Hall (khall) 2013-02-01 14:16:36 UTC
Neither I nor Owen have been able to reproduce this bug.
Comment 5 Kyle M Hall (khall) 2013-02-01 14:17:34 UTC
I should probably note that I forgot to test the pre-patch conditions before signing this patch. My bad!
Comment 6 David Cook 2013-02-03 23:00:34 UTC
(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.
Comment 7 Kyle M Hall (khall) 2013-02-04 12:57:56 UTC
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.
Comment 8 David Cook 2013-02-05 23:12:29 UTC
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.