View | Details | Raw Unified | Return to bug 42107
Collapse All | Expand All

(-)a/Koha/SearchEngine/Elasticsearch/Search.pm (-1 / +4 lines)
Lines 174-186 sub search_compat { Link Here
174
174
175
    # Convert each result into a MARC::Record
175
    # Convert each result into a MARC::Record
176
    my @records;
176
    my @records;
177
    my @scores;
177
178
178
    # opac-search expects results to be put in the
179
    # opac-search expects results to be put in the
179
    # right place in the array, according to $offset
180
    # right place in the array, according to $offset
180
    my $index = $offset;
181
    my $index = $offset;
181
    my $hits  = $results->{'hits'};
182
    my $hits  = $results->{'hits'};
182
    foreach my $es_record ( @{ $hits->{'hits'} } ) {
183
    foreach my $es_record ( @{ $hits->{'hits'} } ) {
183
        $records[ $index++ ] = $self->decode_record_from_result( $es_record->{'_source'} );
184
        $records[$index] = $self->decode_record_from_result( $es_record->{'_source'} );
185
        $scores[ $index++ ] = $es_record->{'_score'};
184
    }
186
    }
185
187
186
    # consumers of this expect a name-spaced result, we provide the default
188
    # consumers of this expect a name-spaced result, we provide the default
Lines 188-193 sub search_compat { Link Here
188
    my %result;
190
    my %result;
189
    $result{biblioserver}{hits}    = $hits->{'total'};
191
    $result{biblioserver}{hits}    = $hits->{'total'};
190
    $result{biblioserver}{RECORDS} = \@records;
192
    $result{biblioserver}{RECORDS} = \@records;
193
    $result{biblioserver}{scores}  = \@scores;
191
194
192
    my $facets = $self->_convert_facets( $results->{aggregations} );
195
    my $facets = $self->_convert_facets( $results->{aggregations} );
193
    if ( C4::Context->interface eq 'opac' ) {
196
    if ( C4::Context->interface eq 'opac' ) {
(-)a/catalogue/search.pl (+1 lines)
Lines 710-715 if ($hits) { Link Here
710
        );
710
        );
711
    $template->param( hits_to_paginate => $hits_to_paginate );
711
    $template->param( hits_to_paginate => $hits_to_paginate );
712
    $template->param( SEARCH_RESULTS   => \@newresults );
712
    $template->param( SEARCH_RESULTS   => \@newresults );
713
    $template->param( SCORES           => $results_hashref->{$server}->{"scores"} );
713
714
714
    # FIXME: no previous_page_offset when pages < 2
715
    # FIXME: no previous_page_offset when pages < 2
715
    $template->param(
716
    $template->param(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-2 / +4 lines)
Lines 680-686 Link Here
680
680
681
                                        [% SEARCH_RESULT.result_number | html %].
681
                                        [% SEARCH_RESULT.result_number | html %].
682
                                        [% SEARCH_RESULT.XSLTResultsRecord | $raw %]
682
                                        [% SEARCH_RESULT.XSLTResultsRecord | $raw %]
683
683
                                        [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]
684
                                            [% SET score_index = loop().index %]
685
                                            <span class="search_score" style="display:none;">Score: [% SCORES.$score_index | html %]</span>
686
                                        [% END %]
684
                                        <p class="hold">
687
                                        <p class="hold">
685
                                            [% IF ( SEARCH_RESULT.norequests ) %]
688
                                            [% IF ( SEARCH_RESULT.norequests ) %]
686
                                                <span class="noholdstext">No holds allowed</span>
689
                                                <span class="noholdstext">No holds allowed</span>
687
- 

Return to bug 42107