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

(-)a/catalogue/showelastic.pl (-5 / +7 lines)
Lines 58-69 my $es_record; Link Here
58
my @es_fields;
58
my @es_fields;
59
59
60
try {
60
try {
61
    $es_record = $es->get_elasticsearch()->get({
61
    my $params = {
62
        index => $es->index_name,
62
        index => $es->index_name,
63
        id    => $biblionumber,
63
        id    => $biblionumber
64
    });
64
    };
65
}
65
    $params->{type} = '_doc' if C4::Context->preference('ElasticsearchIncludeDocType');
66
catch{
66
67
    $es_record = $es->get_elasticsearch()->get( $params );
68
} catch {
67
    warn $_;
69
    warn $_;
68
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
70
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
69
};
71
};
(-)a/installer/data/mysql/atomicupdate/bug_38912.pl (+21 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "BUG_NUMBER",
6
    description => "A single line description",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        $dbh->do(
12
            q{
13
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
14
            ('ElasticsearchIncludeDocType', '0', '', 'When displaying ES records on the details page include the "type => _doc".', 'YesNo')
15
        }
16
        );
17
18
        # sysprefs
19
        say $out "Added new system preference 'ElasticsearchIncludeDocType'";
20
    },
21
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 230-235 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
230
('EdifactInvoiceImport', 'automatic', 'automatic|manual', "If on, don't auto-import EDI invoices, just keep them in the database with the status 'new'", 'Choice'),
230
('EdifactInvoiceImport', 'automatic', 'automatic|manual', "If on, don't auto-import EDI invoices, just keep them in the database with the status 'new'", 'Choice'),
231
('EdifactLSQ', 'location', 'location|ccode', 'Map EDI sequence code (GIR+LSQ) to Koha Item field', 'Choice'),
231
('EdifactLSQ', 'location', 'location|ccode', 'Map EDI sequence code (GIR+LSQ) to Koha Item field', 'Choice'),
232
('ElasticsearchCrossFields', '1', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'),
232
('ElasticsearchCrossFields', '1', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'),
233
('ElasticsearchIncludeDocType', '0', '', 'When displaying ES records on the details page include the "type => _doc".', 'YesNo'),
233
('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL),
234
('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL),
234
('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL),
235
('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL),
235
('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'),
236
('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (-1 / +8 lines)
Lines 95-100 Searching: Link Here
95
                  0: Disable
95
                  0: Disable
96
            - "the cross_fields option for Elasticsearch searches, supported in Elasticsearch 6.X and above."
96
            - "the cross_fields option for Elasticsearch searches, supported in Elasticsearch 6.X and above."
97
            - See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#type-cross-fields">Elasticsearch cross_fields documentation</a>.
97
            - See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#type-cross-fields">Elasticsearch cross_fields documentation</a>.
98
        -
99
            - pref: ElasticsearchIncludeDocType
100
              default: 0
101
              choices:
102
                  1: Do
103
                  0: Don't
104
            - "include the 'type => _doc' parameter when displaying ES records on the details page."
105
            - Due to specific configurations and versions the command to fetch a single record may or may not require this parameter, toggling it should fix 404 errors when viewing ES records from the details page.
98
        -
106
        -
99
            - pref: SavedSearchFilters
107
            - pref: SavedSearchFilters
100
              default: 0
108
              default: 0
101
- 

Return to bug 38912