Bugzilla – Attachment 89249 Details for
Bug 18829
Elasticsearch - Add ability to view the ES indexed record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18829: Elasticsearch - Add ability to view the ES indexed record
Bug-18829-Elasticsearch---Add-ability-to-view-the-.patch (text/plain), 4.08 KB, created by
axel Amghar
on 2019-05-02 15:05:04 UTC
(
hide
)
Description:
Bug 18829: Elasticsearch - Add ability to view the ES indexed record
Filename:
MIME Type:
Creator:
axel Amghar
Created:
2019-05-02 15:05:04 UTC
Size:
4.08 KB
patch
obsolete
>From 97ef907c0357054f35ed9ee1e365e59f8ebf0193 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 29 Apr 2019 11:27:49 +0200 >Subject: [PATCH] Bug 18829: Elasticsearch - Add ability to view the ES indexed > record > >This is groundwork - we need to make the display prettier, but for now >it does at least dump the record into the template > >We probably also need a swtich to enable/disable this - or just move it >into the left hand tabs? >--- > catalogue/detail.pl | 14 +++++++++++ > .../prog/en/modules/catalogue/detail.tt | 28 ++++++++++++++++++++++ > 2 files changed, 42 insertions(+) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 027ca52..b446d6c 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -46,6 +46,8 @@ 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(); >@@ -543,4 +545,16 @@ $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; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 6520134..3f13207 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -169,6 +169,7 @@ > [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %] > <li class="NovelistSelect" style="display:none;"><a href="#NovelistSelect">NoveList Select</a></li> > [% END %] >+[% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %]<li><a href="#esrecord" id="estab">Elasticsearch Record</a></li>[% END %] > </ul> > > [% items_table_block_iter = 0 %] >@@ -698,6 +699,18 @@ > </div> > [% END %] > >+[% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %] >+ <div id="esrecord" class="esrecord"> >+ <div esid="[% biblionumber %]"></div> >+ [% IF esrecord %] >+ <p>[% esrecord %]</p> >+ <script type="application/json" id="stuff">[% (esrecord) %]</script> >+ [% ELSE %] >+ <p>"This record was not found in the ES index"</p> >+ [% END %] >+ </div> >+[% END %] >+ > </div><!-- /bibliodetails --> > > <div id="export" style="margin-top: 1em;"> >@@ -943,6 +956,21 @@ > [% IF ( AmazonCoverImages || LocalCoverImages ) %]$(window).load(function() { > verify_images(); > });[% END %] >+ >+ [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' && 1==0 %] >+ function ESRecord (biblionumber) { >+ $.getJSON("http://localhost:9200/koha_kohadev_biblios/data/", biblionumber, function( data ){ >+ $.each( data, function( key, val ) { >+ console.log("key "+key+"val "+val); >+ }); >+ }); >+ } >+ $(document).ready( function(){ >+ var esid = [% biblionumber %]; >+ ESRecord( esid ); >+ }); >+ [% END %] >+ > </script> > [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %] > <script src="https://imageserver.ebscohost.com/novelistselect/ns2init.js"></script> >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18829
:
64456
|
89001
|
89007
|
89248
|
89249
|
89250
|
90370
|
108103
|
108104
|
108191
|
108944
|
108945
|
148757
|
148758
|
148759
|
148760
|
149400
|
149401
|
149402
|
149403
|
149404
|
149745