@@ -, +, @@
of ES indexed record
- apply the patch
- go to global sysPref
- make sure that SearchEngine have "ElsaticSearch" as value
- Search whatever you want in Search the catalog and select a notice
- Search the link (Ctrl f) : "Elasticsearch Record :" , click on the link
- make sure that the pop-up open and you should see the elasticsearch result in JSON (the pop-up look the same as MARC preview)
---
catalogue/detail.pl | 14 -----
catalogue/showelastic.pl | 64 ++++++++++++++++++++++
.../prog/en/modules/catalogue/detail.tt | 64 ++++++++++++----------
.../prog/en/modules/catalogue/showelastic.tt | 35 ++++++++++++
4 files changed, 133 insertions(+), 44 deletions(-)
create mode 100755 catalogue/showelastic.pl
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/showelastic.tt
--- a/catalogue/detail.pl
+++ a/catalogue/detail.pl
@@ -46,8 +46,6 @@ use Koha::Items;
use Koha::ItemTypes;
use Koha::Patrons;
use Koha::Virtualshelves;
-use LWP::Simple;
-use Koha::SearchEngine::Elasticsearch;
use Koha::Plugins;
my $query = CGI->new();
@@ -545,16 +543,4 @@ $template->param (countdeletedorders => $count_deletedorders_using_biblio);
$template->param (basketsorders => \@baskets_orders);
$template->param (basketsdeletedorders => \@baskets_deletedorders);
-if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) {
- my $es_conf = Koha::SearchEngine::Elasticsearch->new({index=>'biblios'})->get_elasticsearch_params();
- my $es_url;
- my $es_record;
- foreach my $es_node ( @{$es_conf->{nodes}} ){
- $es_url = "http://".$es_node."/".$es_conf->{index_name}."/data/$biblionumber";
- $es_record = get($es_url);
- last if defined $es_record; #can quit once we find the record (should be same in any node)
- }
- $template->param( esrecord => $es_record );
-}
-
output_html_with_http_headers $query, $cookie, $template->output;
--- a/catalogue/showelastic.pl
+++ a/catalogue/showelastic.pl
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+# Koha library project www.koha-community.org
+
+# Copyright 2007 Liblime
+# Parts copyright 2010 BibLibre
+#
+# 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 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.
+#
+# 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.
+
+use Modern::Perl;
+
+# standard or CPAN modules used
+use CGI qw(:standard -utf8);
+use DBI;
+use Encode;
+
+# Koha modules used
+use C4::Context;
+use C4::Output;
+use C4::Auth;
+use C4::Biblio;
+use C4::ImportBatch;
+use C4::XSLT ;
+use Koha::SearchEngine::Elasticsearch;
+use LWP::Simple qw/get/;
+
+my $input= new CGI;
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "catalogue/showelastic.tt",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { catalogue => 1 },
+ debug => 1,
+ }
+);
+
+my $biblionumber = $input->param('id');
+
+my $es_conf = Koha::SearchEngine::Elasticsearch->new({index=>'biblios'})->get_elasticsearch_params();
+my $es_url;
+my $es_record;
+
+foreach my $es_node ( @{$es_conf->{nodes}} ){
+ $es_url = "http://".$es_node."/".$es_conf->{index_name}."/data/$biblionumber";
+ $es_record = get($es_url);
+}
+
+$template->param( esrecord => $es_record);
+output_html_with_http_headers $input, $cookie, $template->output;
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -97,7 +97,12 @@
[% END %]
[% END %]
- MARC Preview:Show
+
+ MARC Preview:Show
+
+ [% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %]
+ Elasticsearch Record :Show
+ [% END %]
[% IF ( holdcount ) %]
@@ -169,7 +174,6 @@
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]