ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / misc / migration_tools / checkNonIndexedBiblios.pl
index d14a1fb..bd47431 100755 (executable)
@@ -4,18 +4,18 @@
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 # Small script that checks if each biblio in the DB is properly indexed
 # if it is not and if you use -z the not-indexed biblios are inserted in zebraqueue
@@ -34,9 +34,10 @@ BEGIN {
 # Koha modules used
 use MARC::Record;
 use C4::Context;
-use C4::Search;
 use Getopt::Long;
 
+use Koha::SearchEngine::Search;
+
 my ( $help, $confirm, $zebraqueue, $silent,$stealth );
 
 GetOptions(
@@ -62,13 +63,14 @@ $| = 1;
 my $sth = $dbh->prepare("SELECT biblionumber FROM biblio");
 my $sth_insert = $dbh->prepare("INSERT INTO zebraqueue (biblio_auth_number,operation,server,done) VALUES (?,'specialUpdate','biblioserver',0)");
 
+my $searcher = Koha::SearchEngine::Search->new({index => 'biblios'});
+
 # We get all biblios
 $sth->execute;
 my ($nbhits);
-
 # We check for each biblio
 while ( my ($biblionumber) = $sth->fetchrow ) {
-    (undef,undef,$nbhits) = SimpleSearch("Local-number=$biblionumber");
+    (undef,undef,$nbhits) = $searcher->simple_search_compat("Local-number=$biblionumber");
     print "biblionumber $biblionumber not indexed\n" unless $nbhits || $stealth;
 # If -z option we put the biblio in zebraqueue
     if ($zebraqueue && !$nbhits){
@@ -105,4 +107,4 @@ Syntax:
 \t./batchCheckNonIndexedBiblios.pl -s (s like silent => don't throws a warn every 1000 biblios to show progress)
 \t./batchCheckNonIndexedBiblios.pl -st (s like stealth => don't throws a warn every 1000 biblios to show progress and no warn for the non indexed biblionumbers, just the total)
 _USAGE_
-}
\ No newline at end of file
+}