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

(-)a/Koha/SearchEngine/Elasticsearch.pm (-5 / +10 lines)
Lines 173-185 sub get_elasticsearch_mappings { Link Here
173
    # TODO cache in the object?
173
    # TODO cache in the object?
174
    my $mappings = {
174
    my $mappings = {
175
        data => {
175
        data => {
176
            _all => {type => "string", analyzer => "analyser_standard"},
177
            properties => {
176
            properties => {
178
                record => {
177
                record => {
179
                    store          => "true",
178
                    store          => "true",
180
                    include_in_all => JSON::false,
179
                    copy_to        => "_all_fields",
181
                    type           => "text",
180
                    type           => "text",
182
                },
181
                },
182
                _all_fields => {
183
                    type => "text",
184
                    analyzer => "analyser_standard"
185
                },
183
            }
186
            }
184
        }
187
        }
185
    };
188
    };
Lines 226-232 sub get_elasticsearch_mappings { Link Here
226
                    search_analyzer => "analyser_phrase",
229
                    search_analyzer => "analyser_phrase",
227
                    analyzer  => "analyser_phrase",
230
                    analyzer  => "analyser_phrase",
228
                    type            => "text",
231
                    type            => "text",
229
                    include_in_all  => JSON::false,
232
                    copy_to         => "_all_fields",
230
                    fields          => {
233
                    fields          => {
231
                        phrase => {
234
                        phrase => {
232
                            type            => "keyword",
235
                            type            => "keyword",
Lines 254-260 sub _elasticsearch_mapping_for_boolean { Link Here
254
257
255
    return {
258
    return {
256
        type            => $type,
259
        type            => $type,
257
        null_value      => 0,
260
        null_value      => 'false',
258
    };
261
    };
259
}
262
}
260
263
Lines 344-350 sub get_fixer_rules { Link Here
344
                # boolean gets special handling, basically if it doesn't exist,
347
                # boolean gets special handling, basically if it doesn't exist,
345
                # it's added and set to false. Otherwise we can't query it.
348
                # it's added and set to false. Otherwise we can't query it.
346
                push @rules,
349
                push @rules,
347
                  "unless exists('$name') add_field('$name', 0) end";
350
                  "unless exists('$name') add_field('$name', 'false') end";
351
                push @rules,
352
                  "if exists('$name') add_field('$name', 'true') end";
348
            }
353
            }
349
            if ($type eq 'sum' ) {
354
            if ($type eq 'sum' ) {
350
                push @rules, "sum('$name')";
355
                push @rules, "sum('$name')";
(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-4 / +3 lines)
Lines 90-96 sub build_query { Link Here
90
            query            => $query,
90
            query            => $query,
91
            fuzziness        => $fuzzy_enabled ? 'auto' : '0',
91
            fuzziness        => $fuzzy_enabled ? 'auto' : '0',
92
            default_operator => 'AND',
92
            default_operator => 'AND',
93
            default_field    => '_all',
93
            default_field    => '_all_fields',
94
            lenient          => JSON::true,
94
            lenient          => JSON::true,
95
        }
95
        }
96
    };
96
    };
Lines 293-299 sub build_authorities_query { Link Here
293
    my @filter_parts;
293
    my @filter_parts;
294
    foreach my $s ( @{ $search->{searches} } ) {
294
    foreach my $s ( @{ $search->{searches} } ) {
295
        my ( $wh, $op, $val ) = @{$s}{qw(where operator value)};
295
        my ( $wh, $op, $val ) = @{$s}{qw(where operator value)};
296
        $wh = '_all' if $wh eq '';
296
        $wh = '_all_fields' if $wh eq '';
297
        if ( $op eq 'is' || $op eq '=' ) {
297
        if ( $op eq 'is' || $op eq '=' ) {
298
298
299
            # look for something that matches completely
299
            # look for something that matches completely
Lines 513-519 types. Link Here
513
=cut
513
=cut
514
514
515
our %index_field_convert = (
515
our %index_field_convert = (
516
    'kw'      => '_all',
516
    'kw'      => '_all_fields',
517
    'ti'      => 'title',
517
    'ti'      => 'title',
518
    'au'      => 'author',
518
    'au'      => 'author',
519
    'su'      => 'subject',
519
    'su'      => 'subject',
520
- 

Return to bug 18969