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

(-)a/Koha/SearchEngine/Elasticsearch.pm (-15 / +8 lines)
Lines 148-157 sub get_elasticsearch_settings { Link Here
148
                        tokenizer => 'standard',
148
                        tokenizer => 'standard',
149
                        filter    => ['lowercase'],
149
                        filter    => ['lowercase'],
150
                    },
150
                    },
151
                    default => {
152
                        tokenizer => 'keyword',
153
                        filter    => ['lowercase'],
154
                    },
155
                },
151
                },
156
            }
152
            }
157
        }
153
        }
Lines 176-184 sub get_elasticsearch_mappings { Link Here
176
        data => {
172
        data => {
177
            properties => {
173
            properties => {
178
                record => {
174
                record => {
179
                    store          => "yes",
175
                    store          => "true",
180
                    include_in_all => JSON::false,
176
                    include_in_all => JSON::false,
181
                    type           => "string",
177
                    type           => "text",
182
                },
178
                },
183
            }
179
            }
184
        }
180
        }
Lines 189-195 sub get_elasticsearch_mappings { Link Here
189
        sub {
185
        sub {
190
            my ( $name, $type, $facet, $suggestible, $sort, $marc_type ) = @_;
186
            my ( $name, $type, $facet, $suggestible, $sort, $marc_type ) = @_;
191
            return if $marc_type ne $marcflavour;
187
            return if $marc_type ne $marcflavour;
192
193
            # TODO if this gets any sort of complexity to it, it should
188
            # TODO if this gets any sort of complexity to it, it should
194
            # be broken out into its own function.
189
            # be broken out into its own function.
195
190
Lines 198-204 sub get_elasticsearch_mappings { Link Here
198
            my $es_type =
193
            my $es_type =
199
              $type eq 'boolean'
194
              $type eq 'boolean'
200
              ? 'boolean'
195
              ? 'boolean'
201
              : 'string';
196
              : 'text';
202
197
203
            if ($es_type eq 'boolean') {
198
            if ($es_type eq 'boolean') {
204
                $mappings->{data}{properties}{$name} = _elasticsearch_mapping_for_boolean( $name, $es_type, $facet, $suggestible, $sort, $marc_type );
199
                $mappings->{data}{properties}{$name} = _elasticsearch_mapping_for_boolean( $name, $es_type, $facet, $suggestible, $sort, $marc_type );
Lines 209-216 sub get_elasticsearch_mappings { Link Here
209
204
210
            if ($facet) {
205
            if ($facet) {
211
                $mappings->{data}{properties}{ $name . '__facet' } = {
206
                $mappings->{data}{properties}{ $name . '__facet' } = {
212
                    type  => "string",
207
                    type  => "keyword",
213
                    index => "not_analyzed",
214
                };
208
                };
215
            }
209
            }
216
            if ($suggestible) {
210
            if ($suggestible) {
Lines 226-238 sub get_elasticsearch_mappings { Link Here
226
                $mappings->{data}{properties}{ $name . '__sort' } = {
220
                $mappings->{data}{properties}{ $name . '__sort' } = {
227
                    search_analyzer => "analyser_phrase",
221
                    search_analyzer => "analyser_phrase",
228
                    analyzer  => "analyser_phrase",
222
                    analyzer  => "analyser_phrase",
229
                    type            => "string",
223
                    type            => "text",
230
                    include_in_all  => JSON::false,
224
                    include_in_all  => JSON::false,
231
                    fields          => {
225
                    fields          => {
232
                        phrase => {
226
                        phrase => {
233
                            search_analyzer => "analyser_phrase",
227
                            search_analyzer => "analyser_phrase",
234
                            analyzer  => "analyser_phrase",
228
                            analyzer  => "analyser_phrase",
235
                            type            => "string",
229
                            type            => "text",
236
                        },
230
                        },
237
                    },
231
                    },
238
                };
232
                };
Lines 272-282 sub _elasticsearch_mapping_for_default { Link Here
272
            phrase => {
266
            phrase => {
273
                search_analyzer => "analyser_phrase",
267
                search_analyzer => "analyser_phrase",
274
                analyzer        => "analyser_phrase",
268
                analyzer        => "analyser_phrase",
275
                type            => "string",
269
                type            => "text",
276
            },
270
            },
277
            raw => {
271
            raw => {
278
                type    => "string",
272
                type    => "keyword",
279
                index   => "not_analyzed",
280
            }
273
            }
281
        },
274
        },
282
    };
275
    };
(-)a/Koha/SearchEngine/Elasticsearch/Indexer.pm (-1 / +2 lines)
Lines 77-83 sub update_index { Link Here
77
            )
77
            )
78
        );
78
        );
79
    }
79
    }
80
    my $array_ref = $from->to_array;
80
81
    #print Data::Dumper::Dumper( $from->to_array );
81
    $self->store->bag->add_many($from);
82
    $self->store->bag->add_many($from);
82
    $self->store->bag->commit;
83
    $self->store->bag->commit;
83
    return 1;
84
    return 1;
(-)a/Koha/SearchEngine/Elasticsearch/Search.pm (-2 / +2 lines)
Lines 257-264 sub count_auth_use { Link Here
257
257
258
    my $query = {
258
    my $query = {
259
        query => {
259
        query => {
260
            filtered => {
260
            bool => {
261
                query  => { match_all => {} },
261
#                query  => { match_all => {} },
262
                filter => { term      => { an => $authid } }
262
                filter => { term      => { an => $authid } }
263
            }
263
            }
264
        }
264
        }
(-)a/t/db_dependent/Koha_Elasticsearch. (-2 / +1 lines)
Lines 20-23 use warnings; Link Here
20
20
21
use Test::More tests => 1;                      # last test to print
21
use Test::More tests => 1;                      # last test to print
22
22
23
use_ok('Koha::Search::Engine::Elasticsearch');
23
use_ok('Koha::SearchEngine::Elasticsearch');
24
- 

Return to bug 17255