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

(-)a/Koha/Authorities.pm (-1 / +7 lines)
Lines 25-30 use Koha::Database; Link Here
25
25
26
use Koha::Authority;
26
use Koha::Authority;
27
27
28
use Koha::SearchEngine::Search;
29
use Koha::SearchEngine::QueryBuilder;
30
28
use base qw(Koha::Objects);
31
use base qw(Koha::Objects);
29
32
30
=head1 NAME
33
=head1 NAME
Lines 51-58 sub get_usage_count { Link Here
51
    my ( $class, $params ) = @_;
54
    my ( $class, $params ) = @_;
52
    my $authid = $params->{authid} || return;
55
    my $authid = $params->{authid} || return;
53
56
57
    my $builder  = Koha::SearchEngine::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
54
    my $searcher = Koha::SearchEngine::Search->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
58
    my $searcher = Koha::SearchEngine::Search->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
55
    my ( $err, $result, $count ) = $searcher->simple_search_compat( 'an:' . $authid, 0, 0 );
59
60
    my ($builderror, $query)= $builder->build_query_compat( undef, [$authid], ['an,ext'], [], []);
61
    my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 );
56
    if( $err ) {
62
    if( $err ) {
57
        warn "Error: $err from search for " . $authid;
63
        warn "Error: $err from search for " . $authid;
58
        return;
64
        return;
(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-2 / +2 lines)
Lines 187-193 sub build_query_compat { Link Here
187
        while ( my ( $oand, $otor, $index ) = $ea->() ) {
187
        while ( my ( $oand, $otor, $index ) = $ea->() ) {
188
            next if ( !defined($oand) || $oand eq '' );
188
            next if ( !defined($oand) || $oand eq '' );
189
            $oand = $self->_clean_search_term($oand);
189
            $oand = $self->_clean_search_term($oand);
190
            $oand = $self->_truncate_terms($oand) if ($truncate);
190
            $oand = $self->_truncate_terms($oand) if ($truncate && $index->{type} ne 'ext');
191
            push @search_params, {
191
            push @search_params, {
192
                operand => $oand,      # the search terms
192
                operand => $oand,      # the search terms
193
                operator => defined($otor) ? uc $otor : undef,    # AND and so on
193
                operator => defined($otor) ? uc $otor : undef,    # AND and so on
Lines 712-718 sub _convert_index_fields { Link Here
712
    my ( $self, @indexes ) = @_;
712
    my ( $self, @indexes ) = @_;
713
713
714
    my %index_type_convert =
714
    my %index_type_convert =
715
      ( __default => undef, phr => 'phrase', rtrn => 'right-truncate', 'st-year' => 'st-year' );
715
      ( __default => undef, phr => 'phrase', rtrn => 'right-truncate', 'st-year' => 'st-year', 'ext' => 'ext' );
716
716
717
    # Convert according to our table, drop anything that doesn't convert.
717
    # Convert according to our table, drop anything that doesn't convert.
718
    # If a field starts with mc- we save it as it's used (and removed) later
718
    # If a field starts with mc- we save it as it's used (and removed) later
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt (-2 / +1 lines)
Lines 44-50 Link Here
44
44
45
<div id="action">
45
<div id="action">
46
    [% IF count %]
46
    [% IF count %]
47
        Used in <a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&amp;op=do_search&amp;q=an=[% authid | uri %]">[% count | html %] record(s)</a>
47
        Used in <a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&amp;op=do_search&amp;idx=an,ext&amp;q=[% authid | uri %]">[% count | html %] record(s)</a>
48
    [% ELSE %]
48
    [% ELSE %]
49
        This authority is not used in any records.
49
        This authority is not used in any records.
50
    [% END %]
50
    [% END %]
51
- 

Return to bug 26608