From 0255e7193d41e8aba728e3e282ba476244b2e633 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@gmail.com>
Date: Thu, 23 Oct 2014 20:12:05 -0300
Subject: [PATCH] Bug 12651: DOM indexing is the default

On the 23 July development meeting it was decided to formally deprecate
GRS-1 indexing mode for Zebra. This patch makes code fallback to DOM
on the remaining places. No behaviour change should be noticed, as DOM
has been the default for a while.

Regards

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
---
 C4/Context.pm                         | 2 +-
 C4/Search.pm                          | 2 +-
 Makefile.PL                           | 8 ++++----
 misc/migration_tools/rebuild_zebra.pl | 4 ++--
 t/db_dependent/zebra_config.pl        | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/C4/Context.pm b/C4/Context.pm
index f59728d..c5f92ee 100644
--- a/C4/Context.pm
+++ b/C4/Context.pm
@@ -720,7 +720,7 @@ sub _new_Zconn {
     $server //= "biblioserver";
 
     if ( $server eq 'biblioserver' ) {
-        $index_mode = $context->{'config'}->{'zebra_bib_index_mode'} // 'grs1';
+        $index_mode = $context->{'config'}->{'zebra_bib_index_mode'} // 'dom';
     } elsif ( $server eq 'authorityserver' ) {
         $index_mode = $context->{'config'}->{'zebra_auth_index_mode'} // 'dom';
     }
diff --git a/C4/Search.pm b/C4/Search.pm
index d46b0c5..ce532a1 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -2592,7 +2592,7 @@ sub new_record_from_zebra {
     my $raw_data = shift;
     # Set the default indexing modes
     my $index_mode = ( $server eq 'biblioserver' )
-                        ? C4::Context->config('zebra_bib_index_mode') // 'grs1'
+                        ? C4::Context->config('zebra_bib_index_mode') // 'dom'
                         : C4::Context->config('zebra_auth_index_mode') // 'dom';
 
     my $marc_record =  eval {
diff --git a/Makefile.PL b/Makefile.PL
index c7600b0..df995ae 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -960,10 +960,10 @@ Primary language for Zebra indexing);
 Koha can use one of  two different indexing modes
 for the MARC bibliographic records:
 
-grs1 - uses the Zebra GRS-1 filter, available
-       for legacy support
 dom  - uses the DOM XML filter; offers improved
        functionality.
+grs1 - [DEPRECATED] uses the Zebra GRS-1 filter,
+       available for legacy support
 
 Bibliographic indexing mode);
     $msg .= _add_valid_values_disp('BIB_INDEX_MODE', $valid_values);
@@ -974,10 +974,10 @@ Bibliographic indexing mode);
 Koha can use one of  two different indexing modes
 for the MARC authorities records:
 
-grs1 - uses the Zebra GRS-1 filter, available
-       for legacy support
 dom  - uses the DOM XML filter; offers improved
        functionality.
+grs1 - [DEPRECATED] uses the Zebra GRS-1 filter,
+       available for legacy support
 
 Authorities indexing mode);
     $msg .= _add_valid_values_disp('AUTH_INDEX_MODE', $valid_values);
diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl
index 682e4be..aa31cb2 100755
--- a/misc/migration_tools/rebuild_zebra.pl
+++ b/misc/migration_tools/rebuild_zebra.pl
@@ -152,8 +152,8 @@ my $biblioserverdir = C4::Context->zebraconfig('biblioserver')->{directory};
 my $authorityserverdir = C4::Context->zebraconfig('authorityserver')->{directory};
 
 my $kohadir = C4::Context->config('intranetdir');
-my $bib_index_mode = C4::Context->config('zebra_bib_index_mode') || 'grs1';
-my $auth_index_mode = C4::Context->config('zebra_auth_index_mode') || 'dom';
+my $bib_index_mode  = C4::Context->config('zebra_bib_index_mode')  // 'dom';
+my $auth_index_mode = C4::Context->config('zebra_auth_index_mode') // 'dom';
 
 my $dbh = C4::Context->dbh;
 my ($biblionumbertagfield,$biblionumbertagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
diff --git a/t/db_dependent/zebra_config.pl b/t/db_dependent/zebra_config.pl
index 2a5e99d..75efb7b 100755
--- a/t/db_dependent/zebra_config.pl
+++ b/t/db_dependent/zebra_config.pl
@@ -10,7 +10,7 @@ use File::Spec;
 my $source = File::Spec->rel2abs('.');
 my $destination = $ARGV[0];
 my $marc_type = $ARGV[1] || 'marc21';
-my $indexing_mode = $ARGV[2] || 'grs1';
+my $indexing_mode = $ARGV[2] || 'dom';
 
 $ENV{__BIB_INDEX_MODE__} = $indexing_mode;
 $ENV{__AUTH_INDEX_MODE__} = $indexing_mode;
-- 
1.9.1