Bug 32033

Summary: Cannot rebuild zebra
Product: Koha Reporter: Chaminda de Silva <chimesh>
Component: bugs.koha-community.orgAssignee: Bugs List <koha-bugs>
Status: CLOSED WORKSFORME QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: dcook
Version: 22.05   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 15187    
Bug Blocks:    

Description Chaminda de Silva 2022-10-28 10:30:49 UTC
My Koha version is 22.05.06.000 and OS is Debian Buster

I tried to manually rebuild koha using  sudo koha-rebuild-zebra -f libcat

(We are using field 880 to insert transliterate terms)

But couldnr rebuil. following error occured


Use of uninitialized value $sub6 in pattern match (m//) at /usr/share/koha/lib/K                                                                                        oha/Filter/MARC/Index880InZebra.pm line 77.
Use of uninitialized value $sub6 in pattern match (m//) at /usr/share/koha/lib/K                                                                                        oha/Filter/MARC/Index880InZebra.pm line 77.
Use of uninitialized value $sub6 in pattern match (m//) at /usr/share/koha/lib/K                                                                                        oha/Filter/MARC/Index880InZebra.pm line 77.
Tag "24 " is not a valid tag. at /usr/share/koha/lib/Koha/Filter/MARC/Index880In                                                                                        Zebra.pm line 79.
Something went wrong rebuilding biblio indexes for libcat
Comment 1 David Cook 2022-10-31 00:35:08 UTC
It looks like you've got bad data there in your record.

Can you share a URL to that record?
Comment 2 Chaminda de Silva 2022-10-31 03:45:25 UTC
(In reply to David Cook from comment #1)
> It looks like you've got bad data there in your record.
> 
> Can you share a URL to that record?

1. How to findout the URL of the particulaar record.
Comment 3 David Cook 2022-10-31 04:34:51 UTC
(In reply to Chaminda de Silva from comment #2)
> 1. How to findout the URL of the particulaar record.

Do you mean how do you determine which record is causing the problem?

You'll need to do a SQL Report. 

You could try something like the following:

SELECT biblionumber, ExtractValue(metadata,'//datafield[@tag="880" and subfield[@code="6" and substring(text(),1,3)="24 "]]/*') as f880 from biblio_metadata HAVING f880 <> ''

Do you have a public OPAC? If you can provide the URL to that OPAC, I can lookup the records once you've given me a biblionumber.
Comment 4 David Cook 2022-10-31 04:36:27 UTC
(As a side note: I'd copied the regex for this from the Elasticsearch code, but really we should've written it at as "(\d\d\d)" rather than "(...)".)
Comment 5 Chaminda de Silva 2022-11-01 14:44:13 UTC
(In reply to David Cook from comment #3)
> (In reply to Chaminda de Silva from comment #2)
> > 1. How to findout the URL of the particulaar record.
> 
> Do you mean how do you determine which record is causing the problem?
> 
> You'll need to do a SQL Report. 
> 
> You could try something like the following:
> 
> SELECT biblionumber, ExtractValue(metadata,'//datafield[@tag="880" and
> subfield[@code="6" and substring(text(),1,3)="24 "]]/*') as f880 from
> biblio_metadata HAVING f880 <> ''
> 
> Do you have a public OPAC? If you can provide the URL to that OPAC, I can
> lookup the records once you've given me a biblionumber.

Thank you  very much David, I figured out the problem of Tag "24 " is not a valid tag using  your SQL Query. It should be Tag "245" not Tag "24 ".
Comment 6 David Cook 2022-11-01 23:10:27 UTC
(In reply to Chaminda de Silva from comment #5)
> Thank you  very much David, I figured out the problem of Tag "24 " is not a
> valid tag using  your SQL Query. It should be Tag "245" not Tag "24 ".

I thought that's what I was saying in my 1st comment. Apologies that I wasn't clearer!

Glad you were able to sort it out.
Comment 7 David Cook 2022-11-01 23:12:00 UTC
Katrin, do you think this should be closed? 

On one hand, failing to reindex due to one bad record seems suboptimal.

On the other hand, if it just warns or silences the error, then it's not obvious there is a problem.
Comment 8 Katrin Fischer 2022-11-02 09:29:20 UTC
That's ok for me, glad it could be resolved. When I tagged you I was not sure if it was related to the recent work on 880 indexing.