Bugzilla – Attachment 64456 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-th.patch (text/plain), 3.92 KB, created by
Nick Clemens (kidclamp)
on 2017-06-20 14:58:50 UTC
(
hide
)
Description:
Bug 18829 - Elasticsearch - Add ability to view the ES indexed record
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-06-20 14:58:50 UTC
Size:
3.92 KB
patch
obsolete
>From 078e6b5b0f8c9476363da6b6795a0960c1e97c4d Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 20 Jun 2017 14:57:29 +0000 >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 | 30 ++++++++++++++++++++++ > 2 files changed, 44 insertions(+) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 3a632b6..fed153f 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -47,6 +47,8 @@ use Koha::Items; > use Koha::ItemTypes; > use Koha::Patrons; > use Koha::Virtualshelves; >+use LWP::Simple; >+use Koha::SearchEngine::Elasticsearch; > > my $query = CGI->new(); > >@@ -519,4 +521,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 1c26c37..88a7845 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -232,6 +232,23 @@ function verify_images() { > [% 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> > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >@@ -613,6 +630,7 @@ function verify_images() { > [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectProfile') && 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 %] >@@ -1108,6 +1126,18 @@ function verify_images() { > </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 class="yui-g" id="export" style="margin-top: 1em;"> >-- >2.1.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