Bug 8620: Any index in DOM mode sensitive to -x flag of rebuild_zebra.pl
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Mon, 4 Mar 2013 21:10:34 +0000 (16:10 -0500)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 7 Mar 2013 14:19:43 +0000 (09:19 -0500)
The definition of the Any index was sensitive to whether
spaces were present between (say) subfield elements in the
MARCXML representation of the bib being indexed.  When using
the -x option to rebuild_zebra.pl, spaces would be present
because of how MARC::File::XML emits MARCXML.

When not using the -x option, spaces would not be present
and the contents of a field would be run together, potentially
as one big token.

The visible behavior was that doing a keyword search by
item barcode would sometimes not work.

To test:
0) Make sure Zebra is using DOM mode
1) Create an item record.
2) Reindex using rebuild_zebra.pl -b -z, *without* -x
3) Do a keyword search by the barcode of the item just
   added; the search shouldn't work
4) Apply patch.
5) Update the following two files:
    etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
    etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl
6) Reindex
7) Do a search that was previously failing.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixes the problem for me - formerly not working callnumbers
and barcodes are now found in keyword (any) searches.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(revised commit description to better explain why it fixes the problem)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Passes all my tests, happy to sign off
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl

index 14f299e..26858e8 100644 (file)
@@ -39,6 +39,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
       <xslo:apply-templates mode="index_heading_conditional"/>
       <xslo:apply-templates mode="index_match_heading"/>
       <xslo:apply-templates mode="index_subject_thesaurus"/>
+      <xslo:apply-templates mode="index_all"/>
     </z:record>
   </xslo:template>
   <xslo:template match="marc:leader">
@@ -2322,7 +2323,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
   </xslo:template>
-  <xslo:template match="*">
+  <xslo:template mode="index_all" match="text()">
     <z:index name="Any:w Any:p">
       <xslo:value-of select="."/>
     </z:index>
index 42b334f..75e2a86 100644 (file)
@@ -61,6 +61,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
                     <xslo:apply-templates mode="index_heading_conditional"/>
                     <xslo:apply-templates mode="index_match_heading"/>
                     <xslo:apply-templates mode="index_subject_thesaurus"/>
+                    <xslo:apply-templates mode="index_all"/>
                 </z:record>
             </xslo:template>
 
@@ -72,7 +73,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
             <xsl:call-template name="handle-index-heading-conditional"/>
             <xsl:call-template name="handle-index-match-heading"/>
             <xsl:apply-templates/>
-            <xslo:template match="*">
+            <xslo:template mode="index_all" match="text()">
                 <z:index name="Any:w Any:p">
                     <xslo:value-of select="."/>
                 </z:index>