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

(-)a/C4/Biblio.pm (-2 / +2 lines)
Lines 2683-2690 sub ModZebra { Link Here
2683
        my $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new(
2683
        my $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new(
2684
            {
2684
            {
2685
                index => $server eq 'biblioserver'
2685
                index => $server eq 'biblioserver'
2686
                ? $Koha::SearchEngine::BIBLIOS_INDEX
2686
                ? Koha::SearchEngine::BIBLIOS_INDEX
2687
                : $Koha::SearchEngine::AUTHORITIES_INDEX
2687
                : Koha::SearchEngine::AUTHORITIES_INDEX
2688
            }
2688
            }
2689
        );
2689
        );
2690
        if ( $op eq 'specialUpdate' ) {
2690
        if ( $op eq 'specialUpdate' ) {
(-)a/C4/Items.pm (-1 / +1 lines)
Lines 2263-2269 sub GetAnalyticsCount { Link Here
2263
    ### ZOOM search here
2263
    ### ZOOM search here
2264
    my $query;
2264
    my $query;
2265
    $query= "hi=".$itemnumber;
2265
    $query= "hi=".$itemnumber;
2266
    my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
2266
    my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX});
2267
    my ($err,$res,$result) = $searcher->simple_search_compat($query,0,10);
2267
    my ($err,$res,$result) = $searcher->simple_search_compat($query,0,10);
2268
    return ($result);
2268
    return ($result);
2269
}
2269
}
(-)a/C4/Matcher.pm (-1 / +1 lines)
Lines 664-670 sub get_matches { Link Here
664
                    #NOTE: double-quote the values so you don't get a "Embedded truncation not supported" error when a term has a ? in it.
664
                    #NOTE: double-quote the values so you don't get a "Embedded truncation not supported" error when a term has a ? in it.
665
            }
665
            }
666
666
667
            my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
667
            my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX});
668
            ( $error, $searchresults, $total_hits ) =
668
            ( $error, $searchresults, $total_hits ) =
669
              $searcher->simple_search_compat( $query, 0, $max_matches, undef, skip_normalize => 1 );
669
              $searcher->simple_search_compat( $query, 0, $max_matches, undef, skip_normalize => 1 );
670
670
(-)a/C4/XISBN.pm (-1 / +1 lines)
Lines 56-62 sub _get_biblio_from_xisbn { Link Here
56
    my $xisbn = shift;
56
    my $xisbn = shift;
57
    my $dbh = C4::Context->dbh;
57
    my $dbh = C4::Context->dbh;
58
58
59
    my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
59
    my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX});
60
    my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( "nb=$xisbn", 0, 1 );
60
    my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( "nb=$xisbn", 0, 1 );
61
    return unless ( !$errors && scalar @$results );
61
    return unless ( !$errors && scalar @$results );
62
62
(-)a/Koha/SearchEngine.pm (-3 / +4 lines)
Lines 19-25 package Koha::SearchEngine; Link Here
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
20
21
use Modern::Perl;
21
use Modern::Perl;
22
use Readonly;
23
22
24
=head1 NAME
23
=head1 NAME
25
24
Lines 42-46 indicate that you want to be working with the authorities index. Link Here
42
# Search engine implementations should compare against these to determine
41
# Search engine implementations should compare against these to determine
43
# what bit of storage is being requested. They will be sensible strings so
42
# what bit of storage is being requested. They will be sensible strings so
44
# may be used for, e.g., directory names.
43
# may be used for, e.g., directory names.
45
Readonly our $BIBLIOS_INDEX     => 'biblios';
44
use constant {
46
Readonly our $AUTHORITIES_INDEX => 'authorities';
45
    BIBLIOS_INDEX     => 'biblios',
46
    AUTHORITIES_INDEX => 'authorities',
47
};
(-)a/Koha/SearchEngine/Elasticsearch.pm (-3 / +4 lines)
Lines 29-35 use Koha::SearchMarcMaps; Link Here
29
use Carp;
29
use Carp;
30
use JSON;
30
use JSON;
31
use Modern::Perl;
31
use Modern::Perl;
32
use Readonly;
33
use Search::Elasticsearch;
32
use Search::Elasticsearch;
34
use Try::Tiny;
33
use Try::Tiny;
35
use YAML::Syck;
34
use YAML::Syck;
Lines 40-47 __PACKAGE__->mk_ro_accessors(qw( index )); Link Here
40
__PACKAGE__->mk_accessors(qw( sort_fields ));
39
__PACKAGE__->mk_accessors(qw( sort_fields ));
41
40
42
# Constants to refer to the standard index names
41
# Constants to refer to the standard index names
43
Readonly our $BIBLIOS_INDEX     => 'biblios';
42
use constant {
44
Readonly our $AUTHORITIES_INDEX => 'authorities';
43
    BIBLIOS_INDEX     => 'biblios',
44
    AUTHORITIES_INDEX => 'authorities',
45
};
45
46
46
=head1 NAME
47
=head1 NAME
47
48
(-)a/Koha/SearchEngine/QueryBuilder.pm (-1 / +1 lines)
Lines 33-39 and just get whatever querybuilder you need. Link Here
33
=head1 SYNOPSIS
33
=head1 SYNOPSIS
34
34
35
    use Koha::SearchEngine::QueryBuilder;
35
    use Koha::SearchEngine::QueryBuilder;
36
    my $qb = Koha::SearchEngine::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
36
    my $qb = Koha::SearchEngine::QueryBuilder->new({index => Koha::SearchEngine::BIBLIOS_INDEX});
37
37
38
=head1 METHODS
38
=head1 METHODS
39
39
(-)a/acqui/neworderbiblio.pl (-2 / +2 lines)
Lines 101-108 my @operands = $query; Link Here
101
my $QParser;
101
my $QParser;
102
$QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser'));
102
$QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser'));
103
my $builtquery;
103
my $builtquery;
104
my $builder  = Koha::SearchEngine::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
104
my $builder  = Koha::SearchEngine::QueryBuilder->new({index => Koha::SearchEngine::BIBLIOS_INDEX});
105
my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
105
my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX});
106
if ($QParser) {
106
if ($QParser) {
107
    $builtquery = $query;
107
    $builtquery = $query;
108
} else {
108
} else {
(-)a/authorities/authorities-home.pl (-2 / +2 lines)
Lines 87-95 if ( $op eq "do_search" ) { Link Here
87
    my $resultsperpage = $query->param('resultsperpage') || 20;
87
    my $resultsperpage = $query->param('resultsperpage') || 20;
88
88
89
    my $builder = Koha::SearchEngine::QueryBuilder->new(
89
    my $builder = Koha::SearchEngine::QueryBuilder->new(
90
        { index => $Koha::SearchEngine::AUTHORITIES_INDEX } );
90
        { index => Koha::SearchEngine::AUTHORITIES_INDEX } );
91
    my $searcher = Koha::SearchEngine::Search->new(
91
    my $searcher = Koha::SearchEngine::Search->new(
92
        { index => $Koha::SearchEngine::AUTHORITIES_INDEX } );
92
        { index => Koha::SearchEngine::AUTHORITIES_INDEX } );
93
    my $search_query = $builder->build_authorities_query_compat(
93
    my $search_query = $builder->build_authorities_query_compat(
94
        [$marclist], [$and_or], [$excluding], [$operator],
94
        [$marclist], [$and_or], [$excluding], [$operator],
95
        [$value], $authtypecode, $orderby
95
        [$value], $authtypecode, $orderby
(-)a/catalogue/search.pl (-2 / +2 lines)
Lines 456-464 my $expanded_facet = $params->{'expand'}; Link Here
456
my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type);
456
my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type);
457
457
458
my $builder = Koha::SearchEngine::QueryBuilder->new(
458
my $builder = Koha::SearchEngine::QueryBuilder->new(
459
    { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
459
    { index => Koha::SearchEngine::BIBLIOS_INDEX } );
460
my $searcher = Koha::SearchEngine::Search->new(
460
my $searcher = Koha::SearchEngine::Search->new(
461
    { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
461
    { index => Koha::SearchEngine::BIBLIOS_INDEX } );
462
462
463
## I. BUILD THE QUERY
463
## I. BUILD THE QUERY
464
(
464
(
(-)a/cataloguing/addbooks.pl (-2 / +2 lines)
Lines 68-76 if ($query) { Link Here
68
    $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser'));
68
    $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser'));
69
    my $builtquery;
69
    my $builtquery;
70
    my $builder = Koha::SearchEngine::QueryBuilder->new(
70
    my $builder = Koha::SearchEngine::QueryBuilder->new(
71
        { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
71
        { index => Koha::SearchEngine::BIBLIOS_INDEX } );
72
    my $searcher = Koha::SearchEngine::Search->new(
72
    my $searcher = Koha::SearchEngine::Search->new(
73
        { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
73
        { index => Koha::SearchEngine::BIBLIOS_INDEX } );
74
    if ($QParser) {
74
    if ($QParser) {
75
        $builtquery = $query;
75
        $builtquery = $query;
76
    } else {
76
    } else {
(-)a/cataloguing/value_builder/marc21_linking_section.pl (-1 / +1 lines)
Lines 182-188 my $launcher = sub { Link Here
182
            $op = 'and';
182
            $op = 'and';
183
        }
183
        }
184
        my $searcher = Koha::SearchEngine::Search->new(
184
        my $searcher = Koha::SearchEngine::Search->new(
185
            { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
185
            { index => Koha::SearchEngine::BIBLIOS_INDEX } );
186
        $search = 'kw:' . $search . " $op mc-itemtype:" . $itype if $itype;
186
        $search = 'kw:' . $search . " $op mc-itemtype:" . $itype if $itype;
187
        my ( $errors, $results, $total_hits ) =
187
        my ( $errors, $results, $total_hits ) =
188
          $searcher->simple_search_compat( $search,
188
          $searcher->simple_search_compat( $search,
(-)a/cataloguing/value_builder/unimarc_field_4XX.pl (-1 / +1 lines)
Lines 368-374 sub plugin { Link Here
368
            $op = 'and';
368
            $op = 'and';
369
        }
369
        }
370
        $search = 'kw:'.$search." $op mc-itemtype:".$itype if $itype;
370
        $search = 'kw:'.$search." $op mc-itemtype:".$itype if $itype;
371
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
371
        my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX});
372
        my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat($search, $startfrom * $resultsperpage, $resultsperpage );
372
        my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat($search, $startfrom * $resultsperpage, $resultsperpage );
373
        if (defined $errors ) {
373
        if (defined $errors ) {
374
            $results = [];
374
            $results = [];
(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 365-371 if (@$barcodes) { Link Here
365
    {
365
    {
366
     $template_params->{FALLBACK} = 1;
366
     $template_params->{FALLBACK} = 1;
367
367
368
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
368
        my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX});
369
        my $query = "kw=" . $barcode;
369
        my $query = "kw=" . $barcode;
370
        my ( $searcherror, $results, $total_hits ) = $searcher->simple_search_compat($query, 0, 10);
370
        my ( $searcherror, $results, $total_hits ) = $searcher->simple_search_compat($query, 0, 10);
371
371
(-)a/misc/migration_tools/bulkmarcimport.pl (-2 / +2 lines)
Lines 251-258 my $searcher = Koha::SearchEngine::Search->new( Link Here
251
    {
251
    {
252
        index => (
252
        index => (
253
              $authorities
253
              $authorities
254
            ? $Koha::SearchEngine::AUTHORITIES_INDEX
254
            ? Koha::SearchEngine::AUTHORITIES_INDEX
255
            : $Koha::SearchEngine::BIBLIOS_INDEX
255
            : Koha::SearchEngine::BIBLIOS_INDEX
256
        )
256
        )
257
    }
257
    }
258
);
258
);
(-)a/misc/search_tools/rebuild_elastic_search.pl (-2 / +2 lines)
Lines 136-142 if ($index_biblios) { Link Here
136
            $records->next();
136
            $records->next();
137
        }
137
        }
138
    }
138
    }
139
    do_reindex($next, $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX);
139
    do_reindex($next, Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX);
140
}
140
}
141
if ($index_authorities) {
141
if ($index_authorities) {
142
    _log(1, "Indexing authorities\n");
142
    _log(1, "Indexing authorities\n");
Lines 153-159 if ($index_authorities) { Link Here
153
            $records->next();
153
            $records->next();
154
        }
154
        }
155
    }
155
    }
156
    do_reindex($next, $Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX);
156
    do_reindex($next, Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX);
157
}
157
}
158
158
159
sub do_reindex {
159
sub do_reindex {
(-)a/opac/opac-authorities-home.pl (-2 / +2 lines)
Lines 59-67 if ( $op eq "do_search" ) { Link Here
59
59
60
    my @tags;
60
    my @tags;
61
    my $builder = Koha::SearchEngine::QueryBuilder->new(
61
    my $builder = Koha::SearchEngine::QueryBuilder->new(
62
        { index => $Koha::SearchEngine::AUTHORITIES_INDEX } );
62
        { index => Koha::SearchEngine::AUTHORITIES_INDEX } );
63
    my $searcher = Koha::SearchEngine::Search->new(
63
    my $searcher = Koha::SearchEngine::Search->new(
64
        { index => $Koha::SearchEngine::AUTHORITIES_INDEX } );
64
        { index => Koha::SearchEngine::AUTHORITIES_INDEX } );
65
    my $search_query = $builder->build_authorities_query_compat( \@marclist, \@and_or,
65
    my $search_query = $builder->build_authorities_query_compat( \@marclist, \@and_or,
66
        \@excluding, \@operator, \@value, $authtypecode, $orderby );
66
        \@excluding, \@operator, \@value, $authtypecode, $orderby );
67
    my $offset = ( $startfrom - 1 ) * $resultsperpage + 1;
67
    my $offset = ( $startfrom - 1 ) * $resultsperpage + 1;
(-)a/serials/subscription-bib-search.pl (-2 / +1 lines)
Lines 99-105 if ( $op eq "do_search" && $query ) { Link Here
99
    $resultsperpage = $input->param('resultsperpage');
99
    $resultsperpage = $input->param('resultsperpage');
100
    $resultsperpage = 20 if ( !defined $resultsperpage );
100
    $resultsperpage = 20 if ( !defined $resultsperpage );
101
101
102
    my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
102
    my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX});
103
    my ( $error, $marcrecords, $total_hits ) =
103
    my ( $error, $marcrecords, $total_hits ) =
104
      $searcher->simple_search_compat( $query, $startfrom * $resultsperpage, $resultsperpage );
104
      $searcher->simple_search_compat( $query, $startfrom * $resultsperpage, $resultsperpage );
105
    my $total = 0;
105
    my $total = 0;
106
- 

Return to bug 16588