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 341-346 if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) { Link Here
341
        #       fetch the list of available indexes (e.g. plugins, etc)
341
        #       fetch the list of available indexes (e.g. plugins, etc)
342
        $es_status->{nodes} = $es_conf->{nodes};
342
        $es_status->{nodes} = $es_conf->{nodes};
343
        my $es = Search::Elasticsearch->new({ nodes => $es_conf->{nodes} });
343
        my $es = Search::Elasticsearch->new({ nodes => $es_conf->{nodes} });
344
        my $es_status->{version} = $es->info->{version}->{number};
344
345
345
        foreach my $index ( @indexes ) {
346
        foreach my $index ( @indexes ) {
346
            my $count;
347
            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', '0', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo')
7
    });
8
    NewVersion( $DBversion, 27252, "Add ElasticsearchCrossFields system preference");
9
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 178-183 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
178
('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL),
178
('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL),
179
('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL),
179
('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL),
180
('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'),
180
('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'),
181
('ElasticsearchCrossFields', '0', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'),
181
('EmailAddressForSuggestions','','',' If you choose EmailAddressForSuggestions you have to enter a valid email address: ','free'),
182
('EmailAddressForSuggestions','','',' If you choose EmailAddressForSuggestions you have to enter a valid email address: ','free'),
182
('emailLibrarianWhenHoldIsPlaced','0',NULL,'If ON, emails the librarian whenever a hold is placed','YesNo'),
183
('emailLibrarianWhenHoldIsPlaced','0',NULL,'If ON, emails the librarian whenever a hold is placed','YesNo'),
183
('EmailPurchaseSuggestions','0','0|EmailAddressForSuggestions|BranchEmailAddress|KohaAdminEmailAddress','Choose email address that new purchase suggestions will be sent to: ','Choice'),
184
('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 382-387 Link Here
382
                    integration. This feature will be removed from Koha in a short term.
385
                    integration. This feature will be removed from Koha in a short term.
383
                    </td></tr>
386
                    </td></tr>
384
                [% END %]
387
                [% END %]
388
                [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' && elasticsearch_status.version.substr(0,1) < 6 %]
389
                    <tr><th scope="row"><strong>Deprecation warning</strong></th><td>
390
                            Elasticsearch version 5.X is not supported in Koha 20.11 and greater. Please upgrade your Elasticsearch cluster
391
                    </td></tr>
392
                [% END %]
393
385
            </table>
394
            </table>
386
        [% END %]
395
        [% END %]
387
396
(-)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 interface."
88
            - "browsing search results from the bibliographic record detail page in staff interface."
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
            - pref : LoadSearchHistoryToTheFirstLoggedUser
99
            - pref : LoadSearchHistoryToTheFirstLoggedUser
92
- 

Return to bug 27252