Bug 7722 - Insidious problem with searching
authorKyle M Hall <kyle@bywatersolutions.com>
Thu, 15 Mar 2012 20:27:07 +0000 (16:27 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 15 May 2012 14:08:51 +0000 (16:08 +0200)
commit377b2fd673f2c4a24f0e1385730516efed9d25a4
tree63eb0633ffcd35c7426b2fe8abb2cc8821beef2e
parentb04899bafde2a7fa06f30bb63020a1a5be774cbc
Bug 7722 - Insidious problem with searching

I cannot find the root cause of this issue, but multiple libraries that I am aware of have problems searching on particular search terms ( and never the same terms at the same library ). The error they get when they trigger this problem is:

Tag "" is not a valid tag. at /home/koha/kohaclone/C4/Biblio.pm line 1849

Something somewhere is adding empty keys to C4::Context->marcfromkohafield, I think it may have something to do with the analytics feature that was added.

In the while loop for TransformKohaToMarc, there is a line

next unless my $dtm = $db_to_marc->{''}->{$name};

I don't think it's working.
If I dump $dtm, for each search, I see the dump twice.
It looks like this:
$VAR1 = [
           '952',
           'w'
         ];
 $VAR1 = [];
I think the second time, when it is empty is what's breaking this.
The next never fails because even though it is empty, it is still a valid arrayref.

The solution I have some up with is to skip over the elements where the arrayref is empty.

Signed-off-by: Ian Walls <koha.sekjal@gmail.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Biblio.pm