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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-1 / +1 lines)
Lines 100-108 sub build_query { Link Here
100
            fields           => $fields,
100
            fields           => $fields,
101
            lenient          => JSON::true,
101
            lenient          => JSON::true,
102
            analyze_wildcard => JSON::true,
102
            analyze_wildcard => JSON::true,
103
            type             => 'cross_fields',
104
        }
103
        }
105
    };
104
    };
105
    $res->{query}->{query_string}->{type} = 'cross_fields' if C4::Context->preference('ElasticsearchCrossFields');
106
106
107
    if ( $options{sort} ) {
107
    if ( $options{sort} ) {
108
        foreach my $sort ( @{ $options{sort} } ) {
108
        foreach my $sort ( @{ $options{sort} } ) {
(-)a/about.pl (+1 lines)
Lines 335-340 if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) { Link Here
335
        #       fetch the list of available indexes (e.g. plugins, etc)
335
        #       fetch the list of available indexes (e.g. plugins, etc)
336
        $es_status->{nodes} = $es_conf->{nodes};
336
        $es_status->{nodes} = $es_conf->{nodes};
337
        my $es = Search::Elasticsearch->new({ nodes => $es_conf->{nodes} });
337
        my $es = Search::Elasticsearch->new({ nodes => $es_conf->{nodes} });
338
        my $es_status->{version} = $es->info->{version}->{number};
338
339
339
        foreach my $index ( @indexes ) {
340
        foreach my $index ( @indexes ) {
340
            my $count;
341
            my $count;
(-)a/installer/data/mysql/atomicupdate/Bug_27252_add_ElasticsearchCrossFields_preference.perl (+9 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    # you can use $dbh here like:
4
    $dbh->do(q{
5
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
6
       ('ElasticsearchCrossFields', '1', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo')
7
    });
8
    NewVersion( $DBversion, 27252, "Add ElasticsearchCrossFields system preference");
9
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 174-179 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
174
('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL),
174
('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL),
175
('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL),
175
('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL),
176
('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'),
176
('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'),
177
('ElasticsearchCrossFields', '1', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'),
177
('EmailAddressForSuggestions','','',' If you choose EmailAddressForSuggestions you have to enter a valid email address: ','free'),
178
('EmailAddressForSuggestions','','',' If you choose EmailAddressForSuggestions you have to enter a valid email address: ','free'),
178
('emailLibrarianWhenHoldIsPlaced','0',NULL,'If ON, emails the librarian whenever a hold is placed','YesNo'),
179
('emailLibrarianWhenHoldIsPlaced','0',NULL,'If ON, emails the librarian whenever a hold is placed','YesNo'),
179
('EmailPurchaseSuggestions','0','0|EmailAddressForSuggestions|BranchEmailAddress|KohaAdminEmailAddress','Choose email address that new purchase suggestions will be sent to: ','Choice'),
180
('EmailPurchaseSuggestions','0','0|EmailAddressForSuggestions|BranchEmailAddress|KohaAdminEmailAddress','Choose email address that new purchase suggestions will be sent to: ','Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt (+9 lines)
Lines 55-60 Link Here
55
                <td><span class="status_warn">[% elasticsearch_fatal_config_error | html %]</span></td>
55
                <td><span class="status_warn">[% elasticsearch_fatal_config_error | html %]</span></td>
56
            [% ELSE %]
56
            [% ELSE %]
57
                <td>
57
                <td>
58
                    Version:
59
                    <span>[% elasticsearch_status.version | html %]</span>
60
                    |
58
                    Nodes:
61
                    Nodes:
59
                    <span>[% elasticsearch_status.nodes.join(' / ') | html %]</span>
62
                    <span>[% elasticsearch_status.nodes.join(' / ') | html %]</span>
60
                    |
63
                    |
Lines 335-340 Link Here
335
                    Some system preferences have badly formatted YAML content: [% bad_yaml_prefs.join(', ') | html %]
338
                    Some system preferences have badly formatted YAML content: [% bad_yaml_prefs.join(', ') | html %]
336
                    </td></tr>
339
                    </td></tr>
337
                [% END %]
340
                [% END %]
341
                [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' && elasticsearch_status.version.substr(0,1) < 6 %]
342
                    <tr><th scope="row"><strong>Deprecation warning</strong></th><td>
343
                            Elasticsearch version 5.x is not supported in Koha 20.11 and greater. Please upgrade your Elasticsearch cluster
344
                    </td></tr>
345
                [% END %]
346
338
            </table>
347
            </table>
339
        [% END %]
348
        [% END %]
340
349
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (-1 / +8 lines)
Lines 86-91 Searching: Link Here
86
                  yes: Enable
86
                  yes: Enable
87
                  no: Disable
87
                  no: Disable
88
            - "browsing search results from the bibliographic record detail page in staff client."
88
            - "browsing search results from the bibliographic record detail page in staff client."
89
        -
90
            - pref: ElasticsearchCrossFields
91
              default: 0
92
              choices:
93
                  yes: Enable
94
                  no: Disable
95
            - "the cross_fields option for Elasticsearch searches, supported in Elasticsearch 6.X and above."
96
            - "See documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#type-cross-fields"
89
    Search form:
97
    Search form:
90
        -
98
        -
91
            - Load the unlogged history to the next user.
99
            - Load the unlogged history to the next user.
92
- 

Return to bug 27252