@@ -, +, @@ indexed record --- catalogue/detail.pl | 14 ++++++++++ .../prog/en/modules/catalogue/detail.tt | 30 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) --- a/catalogue/detail.pl +++ a/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; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/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 %] + + + //]]> @@ -613,6 +630,7 @@ function verify_images() { [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %] [% END %] +[% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %]
  • Elasticsearch Record
  • [% END %] [% items_table_block_iter = 0 %] @@ -1108,6 +1126,18 @@ function verify_images() { [% END %] +[% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %] +
    +
    + [% IF esrecord %] +

    [% esrecord %]

    + + [% ELSE %] +

    "This record was not found in the ES index"

    + [% END %] +
    +[% END %] +
    --