From e3c3936ac2221e8a086e6bfe197d9a02998f8f29 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 22 Mar 2017 12:02:17 -0400 Subject: [PATCH] Bug 17500 - updates for ES 5.1 --- C4/Utils/DataTables/Members.pm | 6 +++--- misc/search_tools/reindex_patrons.pl | 24 +++++++++++++++++------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm index 9998933..97bb30a 100644 --- a/C4/Utils/DataTables/Members.pm +++ b/C4/Utils/DataTables/Members.pm @@ -21,11 +21,11 @@ sub search { $searchmember = $dt_params->{sSearch} // ''; } - my ($sth, $query, $iTotalRecords, $iTotalDisplayRecords); + my ($sth, $query1, $iTotalRecords, $iTotalDisplayRecords); my $dbh = C4::Context->dbh; # Get the iTotalRecords DataTable variable - $query = "SELECT COUNT(borrowers.borrowernumber) FROM borrowers"; - $sth = $dbh->prepare($query); + $query1 = "SELECT COUNT(borrowers.borrowernumber) FROM borrowers"; + $sth = $dbh->prepare($query1); $sth->execute; ($iTotalRecords) = $sth->fetchrow_array; diff --git a/misc/search_tools/reindex_patrons.pl b/misc/search_tools/reindex_patrons.pl index 4d1b689..b6f0448 100644 --- a/misc/search_tools/reindex_patrons.pl +++ b/misc/search_tools/reindex_patrons.pl @@ -12,11 +12,12 @@ $indexer->drop_index; my $patrons = Koha::Patrons->search; + my ( @id_buffer, @commit_buffer ); while ( my $patron = $patrons->next ) { my $id = $patron->borrowernumber; my $record = $patron->unblessed; - $record->{_id} = $id; + $record->{es_id} = $id; $record->{category_type} = $patron->category->category_type; push @id_buffer, $id; push @commit_buffer, $record; @@ -31,19 +32,28 @@ if ( !$indexer->store ) { data => { properties => { borrowernumber => { - type => 'string', + type => 'text', search_analyzer => 'analyser_standard', - index_analyzer => 'analyser_standard', + analyzer => 'analyser_standard', + fielddata => 'true' }, cardnumber => { - type => 'string', + type => 'text', search_analyzer => 'analyser_standard', - index_analyzer => 'analyser_standard', + analyzer => 'analyser_standard', + fielddata => 'true' }, surname => { - type => 'string', + type => 'text', + search_analyzer => 'analyser_standard', + analyzer => 'analyser_standard', + fielddata => 'true' + }, + firstname => { + type => 'text', search_analyzer => 'analyser_standard', - index_analyzer => 'analyser_standard', + analyzer => 'analyser_standard', + fielddata => 'true' }, } } -- 2.1.4