Bug 8620 - Barcode searching not working correctly
Summary: Barcode searching not working correctly
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: master
Hardware: All All
: P5 - low critical (vote)
Assignee: Martin Renvoize
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-12 14:20 UTC by Katrin Fischer
Modified: 2019-06-27 09:24 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Patch for barcode missing in keyword search. (89.18 KB, patch)
2013-02-08 14:34 UTC, Martin Renvoize
Details | Diff | Splinter Review
Patch for barcode missing in keyword search. (88.73 KB, patch)
2013-02-13 11:24 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 8620: Any index overfull in DOM configurations (3.06 KB, patch)
2013-03-04 21:13 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
[SIGNED OFF] Bug 8620: Any index overfull in DOM configurations (3.25 KB, patch)
2013-03-04 21:35 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 8620: Any index in DOM mode sensitive to -x flag of rebuild_zebra.pl (3.87 KB, patch)
2013-03-04 23:38 UTC, Galen Charlton
Details | Diff | Splinter Review
Bug 8620: Any index in DOM mode sensitive to -x flag of rebuild_zebra.pl (4.04 KB, patch)
2013-03-06 10:41 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2012-08-12 14:20:47 UTC
Searching for a barcode with the barcode only as a keyword doesn't find the record. When adding the prefix bc: before the barcode, the barcode is found.

DOM indexing is activated in my installation.
Comment 1 Jorge de Cardenas 2012-08-13 15:56:58 UTC
(In reply to comment #0)
> Searching for a barcode with the barcode only as a keyword doesn't find the
> record. When adding the prefix bc: before the barcode, the barcode is found.
> 
> DOM indexing is activated in my installation.

Katrin,

I am just confirming that your situation is the same as ours.

On the staff 'Home' page, 'Search Catalog' input field. If just a barcode is entered, we get:

No results match your search for 'kw,wrdl: 33529004102850'.

I can successfully search for a barcode by entering bc:33529004102850 in the
'Search Catalog' or by going to the 'Advance Search' selecting Barcode from the
dropdown keyword selection and entering the barcode in the search field.

Jorge
Comment 2 Martin Renvoize 2012-08-15 12:28:46 UTC
We're also having this issue in a few places.  It appears to be direclty related to DOM indexing.

Martin
Comment 3 Jorge de Cardenas 2012-08-15 13:27:19 UTC
This is not a good fix but I replaced:

if(not $index){
   	$index = 'kw';
}

in Search.pm (around line 1182) with:

if(not $index){
	if($operand =~ m/[0-9]{14}/){
			$index = 'bc';
	}else{
         $index = 'kw';
	}
}

Our barcodes are 14 digits long, it tests for 14 digits and sets the index to 'bc' instead of 'kw' when no index was submitted. There is probably a way to fix this through the zebra configuration files but I don't understand them well enough to try it.

Jorge
Comment 4 Ian Bays 2013-02-01 14:14:14 UTC
It seems the line "all any" in record.abs is not carried through to the dom xml and xsl files used.
Another workaround to add barcode back in to the general search is to add the "any" index for the barcode in record.abs, re-generate the xml and xsl then rebuild the zebra indexes.
So the line in record.abs:

melm 952$p      barcode,barcode:n

becomes:

melm 952$p      barcode,barcode:n,any:w

Then follow the wiki to remake xml and xsl (don't just copy/paste as the example is unimarc):
http://wiki.koha-community.org/wiki/Switching_to_dom_indexing

It still does not explain how other main fields are retrieved with "any" but have no explicit "any" index in record.abs, but at least it is not changing the code only to be changed back when fixed.
Comment 5 Martin Renvoize 2013-02-08 14:34:02 UTC Comment hidden (obsolete)
Comment 6 Martin Renvoize 2013-02-13 11:24:14 UTC Comment hidden (obsolete)
Comment 7 Martin Renvoize 2013-02-13 11:25:03 UTC
The new patch re-adds a line that got missed and caused issues in the original patch.
Comment 8 Martin Renvoize 2013-02-13 12:41:48 UTC
As an aside.. the patch I've created only patches the relevant files for MARC21.. though I imagine it's very simple to also patch the ones for UNIMARC.
Comment 9 Jared Camins-Esakov 2013-03-04 21:13:08 UTC Comment hidden (obsolete)
Comment 10 Katrin Fischer 2013-03-04 21:35:28 UTC Comment hidden (obsolete)
Comment 11 Katrin Fischer 2013-03-04 21:36:32 UTC
Martin or Ian, maybe you can test this patch on one of your installations too?
Comment 12 Martin Renvoize 2013-03-04 21:39:21 UTC
I'll also test this one tomorrow... would be nice to get the any index all working properly!

Martin
Comment 13 Galen Charlton 2013-03-04 22:49:11 UTC
In my testing, the bug appeared if the -x option to rebuild_zebra.pl was omitted -- i.e., searching by barcode-as-keyword didn't work then.  If one of the affected records was reindexed with the -x option, it worked.
Comment 14 Galen Charlton 2013-03-04 23:38:18 UTC Comment hidden (obsolete)
Comment 15 Katrin Fischer 2013-03-06 07:15:25 UTC
I am inclined to pass this QA as we have another sign-off from Galen - RM?
Comment 16 Martin Renvoize 2013-03-06 10:41:21 UTC
Created attachment 15905 [details] [review]
Bug 8620: Any index in DOM mode sensitive to -x flag of rebuild_zebra.pl

Works as expected; Will be glad to see this get pushed.
Comment 17 Katrin Fischer 2013-03-06 11:31:34 UTC
Switching this to Passed QA.
Comment 18 Jared Camins-Esakov 2013-03-07 14:20:09 UTC
This patch has been pushed to master.
Comment 19 Chris Cormack 2013-03-11 09:22:02 UTC
Pushed to 3.10.x and 3.8.x will be in 3.10.4 and 3.8.11