Bug 20697

Summary: Remove some Host-Item-Number noise from zebra-output.log when EasyAnalyticalRecords is not used
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Searching - ZebraAssignee: Marcel de Rooy <m.de.rooy>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: charles.farmer, fridolin.somers, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9566
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20702
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 20697: Bind calling GetAnalyticsCount to pref EasyAnalyticalRecords
Bug 20697: Bind calling GetAnalyticsCount to pref EasyAnalyticalRecords
Bug 20697: Bind calling GetAnalyticsCount to pref EasyAnalyticalRecords

Description Marcel de Rooy 2018-05-02 14:33:12 UTC
Each week I find thousands of lines like this in zebra-output.log:
zebrasrv(1096) [request] Search biblios ERROR 114 1 1+0 RPN @attrset Bib-1 @attr 1=8911 259186
They can be found in a 16.11 production log but also on a fresh master.

NOTE:
1=8911 refers to searching Host-Item-Number
Error 114 says: [114] Unsupported Use attribute -- v2 addinfo '8911'
But 8911 is in bib1.att though.

What triggers these searches in the codebase ? Any idea ?
Do you also see a lot of these errors in your zebra logs ?
Comment 1 Nick Clemens 2018-05-02 14:49:50 UTC
(In reply to Marcel de Rooy from comment #0)
I can recreate.

It seems to be pulling up the details page in the staff client that triggers this.

The number at the end of the error is the itemnumber(s) for that record.
Comment 2 Marcel de Rooy 2018-05-03 10:08:55 UTC
So I found him with Nick's comment in catalogue/detail.pl:

my $countanalytics= GetAnalyticsCount($item->{itemnumber});
This sub builds a Zebra query with "hi"=itemnumber

If you have no records with 773$9 filled, Zebra did not use the index Host-Item-Number and will return error 114 Unsupported Use attribute.
Comment 3 Marcel de Rooy 2018-05-03 11:19:42 UTC
Created attachment 75002 [details] [review]
Bug 20697: Bind calling GetAnalyticsCount to pref EasyAnalyticalRecords

If you do not use the EasyAnalyticalRecords feature (introduced with
bug 5528), you will have a lot of warnings in zebra-output.log like:

zebrasrv(1096) [request] Search biblios ERROR 114 1 1+0 RPN @attrset Bib-1 @attr 1=8911 259186

They come from C4::Items::GetAnalyticsCount called by catalogue/detail.pl.
This sub starts a Zebra search on index 'hi' (Host-Item-Number).
If you do not use this field at all (related to 773$9 in MARC21), Zebra
returns an Unsupported Use attribute error (114).

In making this change, I added one minor change:
[1] Remove the commented GetAnalyticsCount in additem.pl and correcting
    indentation in that loop (removing tabs). So no change at all there.

NOTE: I will propose to bind the GetHostItemsInfo call in detail.pl and two
other scripts to this preference too on report 20702.

Test plan:
[1] If you use EasyAnalytics, verify that there is no change.
[2] If you do not, check the zebra-output.log. You should no longer see
    searches for Host-Item-Number with 1=8911. (As well as ERROR 114 on
    this index.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Charles Farmer 2018-05-11 22:18:51 UTC
The code change makes sense, as does the reasoning behind it, but I can't reproduce on a fresh master install.

Could you give more information on the records and framework you used?
Comment 5 Marcel de Rooy 2018-05-14 06:40:23 UTC
(In reply to Charles Farmer from comment #4)
> The code change makes sense, as does the reasoning behind it, but I can't
> reproduce on a fresh master install.
> 
> Could you give more information on the records and framework you used?

Yes, this test plan was a bit short..

On a fresh master, you should be able to recreate this with just one record. You need Zebra obviously. Without this patch:
Assuming the pref is disabled and you did not use 773$9, going to catalogue/detail.pl for a record with at least one item, should trigger the search hi=itemnumber. If you did not use 773$9, the Error 114 on 1=8911 should be found in your zebra-output.log.
With this patch, you should no longer see 1=8911.
Comment 6 Charles Farmer 2018-06-22 21:48:41 UTC
That's perfect. I was able to reproduce and confirm that your patch fixes the issue.
Comment 7 Charles Farmer 2018-06-22 21:49:11 UTC
Created attachment 76314 [details] [review]
Bug 20697: Bind calling GetAnalyticsCount to pref EasyAnalyticalRecords

If you do not use the EasyAnalyticalRecords feature (introduced with
bug 5528), you will have a lot of warnings in zebra-output.log like:

zebrasrv(1096) [request] Search biblios ERROR 114 1 1+0 RPN @attrset Bib-1 @attr 1=8911 259186

They come from C4::Items::GetAnalyticsCount called by catalogue/detail.pl.
This sub starts a Zebra search on index 'hi' (Host-Item-Number).
If you do not use this field at all (related to 773$9 in MARC21), Zebra
returns an Unsupported Use attribute error (114).

In making this change, I added one minor change:
[1] Remove the commented GetAnalyticsCount in additem.pl and correcting
    indentation in that loop (removing tabs). So no change at all there.

NOTE: I will propose to bind the GetHostItemsInfo call in detail.pl and two
other scripts to this preference too on report 20702.

Test plan:
[1] If you use EasyAnalytics, verify that there is no change.
[2] If you do not, check the zebra-output.log. You should no longer see
    searches for Host-Item-Number with 1=8911. (As well as ERROR 114 on
    this index.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 8 Martin Renvoize 2018-06-27 08:59:15 UTC
Created attachment 76476 [details] [review]
Bug 20697: Bind calling GetAnalyticsCount to pref EasyAnalyticalRecords

If you do not use the EasyAnalyticalRecords feature (introduced with
bug 5528), you will have a lot of warnings in zebra-output.log like:

zebrasrv(1096) [request] Search biblios ERROR 114 1 1+0 RPN @attrset Bib-1 @attr 1=8911 259186

They come from C4::Items::GetAnalyticsCount called by catalogue/detail.pl.
This sub starts a Zebra search on index 'hi' (Host-Item-Number).
If you do not use this field at all (related to 773$9 in MARC21), Zebra
returns an Unsupported Use attribute error (114).

In making this change, I added one minor change:
[1] Remove the commented GetAnalyticsCount in additem.pl and correcting
    indentation in that loop (removing tabs). So no change at all there.

NOTE: I will propose to bind the GetHostItemsInfo call in detail.pl and two
other scripts to this preference too on report 20702.

Test plan:
[1] If you use EasyAnalytics, verify that there is no change.
[2] If you do not, check the zebra-output.log. You should no longer see
    searches for Host-Item-Number with 1=8911. (As well as ERROR 114 on
    this index.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2018-06-27 09:00:12 UTC
Looks good to me and tests all still pass.. passing QA.
Comment 10 Nick Clemens 2018-06-29 21:02:31 UTC
Awesome work all!

Pushed to master for 18.11
Comment 11 Martin Renvoize 2018-07-02 08:17:50 UTC
Pushed to 18.05.x for 18.05.02, always good to silence some warnings :)
Comment 12 Fridolin Somers 2018-07-04 08:00:29 UTC
Pushed to 17.11.x for 17.11.08

Work I tried to start a long time ago. I'm pleased to see it done ;)