Bug 21286: Add Corporate-name as phrase to zebra indexes

When using Zebra for searching, Koha performs a number of searches in order
to improve relevancy. This means that even for 'wordlist' search, we perform a phrase search.

When selecting 'Corporate-name' as an index, this expansion of the search causes errors and fails
the search

We can fix this for 'Corporate-name' searches by adding a phrase index

To test:
 1 - Edit koha-conf.xml and uncomment the zebra debug line and add 'request' to the list
 2 - Restart all
 3 - tail -f /var/log/koha/kohadev/zebra-output.log
 4 - Edit a record to add a 110 field e.g. 'House plants'
 5 - Enable syspref IntranetCatalogSearchPulldown
 6 - Search for 'Corporate name' and term 'House plants'
 7 - No results
 8 - View the log, see 'ERROR' and full search terms listed
 9 - Apply patch
10 - copy the zebra files to the production instance:
    cp etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml
    cp etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
11 - restart all
12 - rebuild: sudo koha-rebuild-zebra -v -f kohadev
13 - Repeat search
14 - Success!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2021-05-24 13:13:10 +00:00 committed by Kyle M Hall
parent a5d1614da6
commit ac593159a2
2 changed files with 10 additions and 5 deletions

View file

@ -297,6 +297,7 @@
<target_index>Name:w</target_index>
<target_index>Name-and-title:w</target_index>
<target_index>Corporate-name:w</target_index>
<target_index>Corporate-name:p</target_index>
</index_data_field>
<!--record.abs line 95: melm 111$9 Koha-Auth-Number-->
<index_subfields tag="111" subfields="9">
@ -515,6 +516,7 @@
<index_data_field tag="410">
<target_index>Author:w</target_index>
<target_index>Corporate-name:w</target_index>
<target_index>Corporate-name:p</target_index>
</index_data_field>
<!--record.abs line 133: melm 411$a Name-and-title-->
<index_subfields tag="411" subfields="a">
@ -679,6 +681,7 @@
<target_index>Subject:w</target_index>
<target_index>Subject:p</target_index>
<target_index>Corporate-name:w</target_index>
<target_index>Corporate-name:p</target_index>
</index_data_field>
<!--record.abs line 169: melm 611$a Name-and-title,Subject,Subject:p-->
<index_subfields tag="611" subfields="a">
@ -917,6 +920,7 @@
<target_index>Author:w</target_index>
<target_index>Author:p</target_index>
<target_index>Corporate-name:w</target_index>
<target_index>Corporate-name:p</target_index>
<target_index>Name:w</target_index>
</index_data_field>
<!--record.abs line 213: melm 711$a Name-and-title-->
@ -1114,6 +1118,7 @@
<index_data_field tag="810">
<target_index>Author:w</target_index>
<target_index>Corporate-name:w</target_index>
<target_index>Corporate-name:p</target_index>
<target_index>Author-name-corporate:w</target_index>
<target_index>Name:w</target_index>
</index_data_field>

View file

@ -1910,7 +1910,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:template>
<xslo:template mode="index_data_field" match="marc:datafield[@tag='110']">
<z:index name="Author:w Author:p Author:s Author-title:w Author-name-corporate:w Name:w Name-and-title:w Corporate-name:w">
<z:index name="Author:w Author:p Author:s Author-title:w Author-name-corporate:w Name:w Name-and-title:w Corporate-name:w Corporate-name:p">
<xslo:variable name="raw_heading">
<xslo:for-each select="marc:subfield">
<xslo:if test="position() &gt; 1">
@ -2131,7 +2131,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:template>
<xslo:template mode="index_data_field" match="marc:datafield[@tag='410']">
<z:index name="Author:w Corporate-name:w">
<z:index name="Author:w Corporate-name:w Corporate-name:p">
<xslo:variable name="raw_heading">
<xslo:for-each select="marc:subfield">
<xslo:if test="position() &gt; 1">
@ -2274,7 +2274,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:template>
<xslo:template mode="index_data_field" match="marc:datafield[@tag='610']">
<z:index name="Name:w Subject:w Subject:p Corporate-name:w">
<z:index name="Name:w Subject:w Subject:p Corporate-name:w Corporate-name:p">
<xslo:variable name="raw_heading">
<xslo:for-each select="marc:subfield">
<xslo:if test="position() &gt; 1">
@ -2443,7 +2443,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:template>
<xslo:template mode="index_data_field" match="marc:datafield[@tag='710']">
<z:index name="Author:w Author:p Corporate-name:w Name:w">
<z:index name="Author:w Author:p Corporate-name:w Corporate-name:p Name:w">
<xslo:variable name="raw_heading">
<xslo:for-each select="marc:subfield">
<xslo:if test="position() &gt; 1">
@ -2547,7 +2547,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:template>
<xslo:template mode="index_data_field" match="marc:datafield[@tag='810']">
<z:index name="Author:w Corporate-name:w Author-name-corporate:w Name:w">
<z:index name="Author:w Corporate-name:w Corporate-name:p Author-name-corporate:w Name:w">
<xslo:variable name="raw_heading">
<xslo:for-each select="marc:subfield">
<xslo:if test="position() &gt; 1">