Lines 100-106
subtest 'get_elasticsearch_settings() tests' => sub {
Link Here
|
100 |
# test reading index settings |
100 |
# test reading index settings |
101 |
my $es = Koha::SearchEngine::Elasticsearch->new( {index => $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX} ); |
101 |
my $es = Koha::SearchEngine::Elasticsearch->new( {index => $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX} ); |
102 |
$settings = $es->get_elasticsearch_settings(); |
102 |
$settings = $es->get_elasticsearch_settings(); |
103 |
is( $settings->{index}{analysis}{analyzer}{analyser_phrase}{tokenizer}, 'keyword', 'Index settings parsed correctly' ); |
103 |
is( $settings->{index}{analysis}{analyzer}{analyzer_phrase}{tokenizer}, 'keyword', 'Index settings parsed correctly' ); |
104 |
}; |
104 |
}; |
105 |
|
105 |
|
106 |
subtest 'get_elasticsearch_mappings() tests' => sub { |
106 |
subtest 'get_elasticsearch_mappings() tests' => sub { |
Lines 112-118
subtest 'get_elasticsearch_mappings() tests' => sub {
Link Here
|
112 |
# test reading mappings |
112 |
# test reading mappings |
113 |
my $es = Koha::SearchEngine::Elasticsearch->new( {index => $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX} ); |
113 |
my $es = Koha::SearchEngine::Elasticsearch->new( {index => $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX} ); |
114 |
$mappings = $es->get_elasticsearch_mappings(); |
114 |
$mappings = $es->get_elasticsearch_mappings(); |
115 |
is( $mappings->{data}{_all}{type}, 'string', 'Field mappings parsed correctly' ); |
115 |
is( $mappings->{data}{properties}{isbn__sort}{index}, 'false', 'Field mappings parsed correctly' ); |
116 |
}; |
116 |
}; |
117 |
|
117 |
|
118 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
118 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
Lines 128-133
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
128 |
type => 'string', |
128 |
type => 'string', |
129 |
facet => 0, |
129 |
facet => 0, |
130 |
suggestible => 0, |
130 |
suggestible => 0, |
|
|
131 |
searchable => 1, |
131 |
sort => undef, |
132 |
sort => undef, |
132 |
marc_type => 'marc21', |
133 |
marc_type => 'marc21', |
133 |
marc_field => '001', |
134 |
marc_field => '001', |
Lines 137-142
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
137 |
type => 'isbn', |
138 |
type => 'isbn', |
138 |
facet => 0, |
139 |
facet => 0, |
139 |
suggestible => 0, |
140 |
suggestible => 0, |
|
|
141 |
searchable => 1, |
140 |
sort => 0, |
142 |
sort => 0, |
141 |
marc_type => 'marc21', |
143 |
marc_type => 'marc21', |
142 |
marc_field => '020a', |
144 |
marc_field => '020a', |
Lines 146-151
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
146 |
type => 'string', |
148 |
type => 'string', |
147 |
facet => 1, |
149 |
facet => 1, |
148 |
suggestible => 1, |
150 |
suggestible => 1, |
|
|
151 |
searchable => 1, |
149 |
sort => undef, |
152 |
sort => undef, |
150 |
marc_type => 'marc21', |
153 |
marc_type => 'marc21', |
151 |
marc_field => '100a', |
154 |
marc_field => '100a', |
Lines 155-160
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
155 |
type => 'string', |
158 |
type => 'string', |
156 |
facet => 1, |
159 |
facet => 1, |
157 |
suggestible => 1, |
160 |
suggestible => 1, |
|
|
161 |
searchable => 1, |
158 |
sort => 1, |
162 |
sort => 1, |
159 |
marc_type => 'marc21', |
163 |
marc_type => 'marc21', |
160 |
marc_field => '110a', |
164 |
marc_field => '110a', |
Lines 164-169
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
164 |
type => 'string', |
168 |
type => 'string', |
165 |
facet => 0, |
169 |
facet => 0, |
166 |
suggestible => 1, |
170 |
suggestible => 1, |
|
|
171 |
searchable => 1, |
167 |
sort => 1, |
172 |
sort => 1, |
168 |
marc_type => 'marc21', |
173 |
marc_type => 'marc21', |
169 |
marc_field => '245(ab)ab', |
174 |
marc_field => '245(ab)ab', |
Lines 173-178
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
173 |
type => 'string', |
178 |
type => 'string', |
174 |
facet => 0, |
179 |
facet => 0, |
175 |
suggestible => 1, |
180 |
suggestible => 1, |
|
|
181 |
searchable => 1, |
176 |
sort => 1, |
182 |
sort => 1, |
177 |
marc_type => 'unimarc', |
183 |
marc_type => 'unimarc', |
178 |
marc_field => '245a', |
184 |
marc_field => '245a', |
Lines 182-187
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
182 |
type => 'string', |
188 |
type => 'string', |
183 |
facet => 0, |
189 |
facet => 0, |
184 |
suggestible => undef, |
190 |
suggestible => undef, |
|
|
191 |
searchable => 1, |
185 |
sort => 0, |
192 |
sort => 0, |
186 |
marc_type => 'marc21', |
193 |
marc_type => 'marc21', |
187 |
marc_field => '220', |
194 |
marc_field => '220', |
Lines 191-196
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
191 |
type => 'string', |
198 |
type => 'string', |
192 |
facet => 0, |
199 |
facet => 0, |
193 |
suggestible => 0, |
200 |
suggestible => 0, |
|
|
201 |
searchable => 1, |
194 |
sort => undef, |
202 |
sort => undef, |
195 |
marc_type => 'marc21', |
203 |
marc_type => 'marc21', |
196 |
marc_field => '245', |
204 |
marc_field => '245', |
Lines 200-205
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
200 |
type => 'sum', |
208 |
type => 'sum', |
201 |
facet => 0, |
209 |
facet => 0, |
202 |
suggestible => 0, |
210 |
suggestible => 0, |
|
|
211 |
searchable => 1, |
203 |
sort => 0, |
212 |
sort => 0, |
204 |
marc_type => 'marc21', |
213 |
marc_type => 'marc21', |
205 |
marc_field => '952g', |
214 |
marc_field => '952g', |
Lines 209-214
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
209 |
type => 'boolean', |
218 |
type => 'boolean', |
210 |
facet => 0, |
219 |
facet => 0, |
211 |
suggestible => 0, |
220 |
suggestible => 0, |
|
|
221 |
searchable => 1, |
212 |
sort => 0, |
222 |
sort => 0, |
213 |
marc_type => 'marc21', |
223 |
marc_type => 'marc21', |
214 |
marc_field => '9520', |
224 |
marc_field => '9520', |
Lines 218-223
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
218 |
type => 'string', |
228 |
type => 'string', |
219 |
facet => 0, |
229 |
facet => 0, |
220 |
suggestible => 0, |
230 |
suggestible => 0, |
|
|
231 |
searchable => 1, |
221 |
sort => 1, |
232 |
sort => 1, |
222 |
marc_type => 'marc21', |
233 |
marc_type => 'marc21', |
223 |
marc_field => '952o', |
234 |
marc_field => '952o', |
Lines 227-232
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
227 |
type => 'string', |
238 |
type => 'string', |
228 |
facet => 0, |
239 |
facet => 0, |
229 |
suggestible => 0, |
240 |
suggestible => 0, |
|
|
241 |
searchable => 1, |
230 |
sort => 0, |
242 |
sort => 0, |
231 |
marc_type => 'marc21', |
243 |
marc_type => 'marc21', |
232 |
marc_field => 'leader_/6', |
244 |
marc_field => 'leader_/6', |
Lines 236-241
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
236 |
type => 'string', |
248 |
type => 'string', |
237 |
facet => 0, |
249 |
facet => 0, |
238 |
suggestible => 0, |
250 |
suggestible => 0, |
|
|
251 |
searchable => 1, |
239 |
sort => 0, |
252 |
sort => 0, |
240 |
marc_type => 'marc21', |
253 |
marc_type => 'marc21', |
241 |
marc_field => 'leader_/6-7', |
254 |
marc_field => 'leader_/6-7', |
Lines 245-250
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
245 |
type => 'string', |
258 |
type => 'string', |
246 |
facet => 0, |
259 |
facet => 0, |
247 |
suggestible => 0, |
260 |
suggestible => 0, |
|
|
261 |
searchable => 1, |
248 |
sort => 0, |
262 |
sort => 0, |
249 |
marc_type => 'marc21', |
263 |
marc_type => 'marc21', |
250 |
marc_field => '007_/0', |
264 |
marc_field => '007_/0', |
Lines 262-267
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
262 |
$map->{facet}, |
276 |
$map->{facet}, |
263 |
$map->{suggestible}, |
277 |
$map->{suggestible}, |
264 |
$map->{sort}, |
278 |
$map->{sort}, |
|
|
279 |
$map->{searchable}, |
265 |
$map->{marc_type}, |
280 |
$map->{marc_type}, |
266 |
$map->{marc_field} |
281 |
$map->{marc_field} |
267 |
); |
282 |
); |
Lines 307-313
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
307 |
|
322 |
|
308 |
# First record: |
323 |
# First record: |
309 |
is(scalar @{$docs}, 2, 'Two records converted to documents'); |
324 |
is(scalar @{$docs}, 2, 'Two records converted to documents'); |
310 |
|
|
|
311 |
is($docs->[0][0], '1234567', 'First document biblionumber should be set as first element in document touple'); |
325 |
is($docs->[0][0], '1234567', 'First document biblionumber should be set as first element in document touple'); |
312 |
|
326 |
|
313 |
is_deeply($docs->[0][1]->{control_number}, ['123'], 'First record control number should be set correctly'); |
327 |
is_deeply($docs->[0][1]->{control_number}, ['123'], 'First record control number should be set correctly'); |
Lines 519-524
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () t
Link Here
|
519 |
facet => 0, |
533 |
facet => 0, |
520 |
suggestible => 0, |
534 |
suggestible => 0, |
521 |
sort => undef, |
535 |
sort => undef, |
|
|
536 |
searchable => 1, |
522 |
marc_type => 'marc21', |
537 |
marc_type => 'marc21', |
523 |
marc_field => '001', |
538 |
marc_field => '001', |
524 |
} |
539 |
} |
Lines 535-540
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () t
Link Here
|
535 |
$map->{facet}, |
550 |
$map->{facet}, |
536 |
$map->{suggestible}, |
551 |
$map->{suggestible}, |
537 |
$map->{sort}, |
552 |
$map->{sort}, |
|
|
553 |
$map->{searchable}, |
538 |
$map->{marc_type}, |
554 |
$map->{marc_type}, |
539 |
$map->{marc_field} |
555 |
$map->{marc_field} |
540 |
); |
556 |
); |
541 |
- |
|
|