equal
deleted
inserted
replaced
39 "field" => "subject.label_code", |
39 "field" => "subject.label_code", |
40 "size" => config('corpusparole.theme_default_limit'), |
40 "size" => config('corpusparole.theme_default_limit'), |
41 "order" => [ '_count' => 'desc' ], |
41 "order" => [ '_count' => 'desc' ], |
42 "include" => ".*\|bnf\|.*" |
42 "include" => ".*\|bnf\|.*" |
43 ] |
43 ] |
|
44 ], |
|
45 "subjects_count" => [ |
|
46 "cardinality" => [ |
|
47 "field" => "subject.label_code" |
|
48 ] |
44 ] |
49 ] |
45 ] |
50 ] |
46 ] |
51 ] |
47 ] |
52 ] |
48 ] |
53 ] |
93 "doc_count" => 989 |
98 "doc_count" => 989 |
94 ], [ |
99 ], [ |
95 "key" => "arbres|bnf|ark:/12148/cb11934786x", |
100 "key" => "arbres|bnf|ark:/12148/cb11934786x", |
96 "doc_count" => 989 |
101 "doc_count" => 989 |
97 ] ] |
102 ] ] |
|
103 ], |
|
104 "subjects_count" => [ |
|
105 "value" => 999 |
98 ] |
106 ] |
99 ] |
107 ] |
100 ] |
108 ] |
101 ]); |
109 ]); |
102 $this->get('/api/v1/stats/themes/')->assertTrue($this->response->isOk(), $this->response->content()); |
110 $this->get('/api/v1/stats/themes/')->assertTrue($this->response->isOk(), $this->response->content()); |
107 "http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ], |
115 "http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ], |
108 "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ], |
116 "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ], |
109 "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995 ], |
117 "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995 ], |
110 "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ], |
118 "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ], |
111 "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ] |
119 "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ] |
112 ]]); |
120 ], "meta" => ['total' => 999]]); |
113 |
121 |
114 } |
122 } |
115 |
123 |
116 public function testIndexAll() { |
124 public function testIndexAll() { |
117 |
125 |
129 "subjects" => [ |
137 "subjects" => [ |
130 "terms" => [ |
138 "terms" => [ |
131 "field" => "subject.label_code", |
139 "field" => "subject.label_code", |
132 "size" => config('corpusparole.theme_default_limit'), |
140 "size" => config('corpusparole.theme_default_limit'), |
133 "order" => [ '_count' => 'desc' ] |
141 "order" => [ '_count' => 'desc' ] |
|
142 ] |
|
143 ], |
|
144 "subjects_count" => [ |
|
145 "cardinality" => [ |
|
146 "field" => "subject.label_code" |
134 ] |
147 ] |
135 ] |
148 ] |
136 ] |
149 ] |
137 ] |
150 ] |
138 ] |
151 ] |
190 "doc_count" => 989 |
203 "doc_count" => 989 |
191 ], [ |
204 ], [ |
192 "key" => "arbres|bnf|ark:/12148/cb11934786x", |
205 "key" => "arbres|bnf|ark:/12148/cb11934786x", |
193 "doc_count" => 989 |
206 "doc_count" => 989 |
194 ] ] |
207 ] ] |
|
208 ], |
|
209 "subjects_count" => [ |
|
210 "value" => 999 |
195 ] |
211 ] |
196 ] |
212 ] |
197 ] |
213 ] |
198 ]); |
214 ]); |
199 $this->get('/api/v1/stats/themes/?filter=all')->assertTrue($this->response->isOk(), $this->response->content()); |
215 $this->get('/api/v1/stats/themes/?filter=all')->assertTrue($this->response->isOk(), $this->response->content()); |
206 "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ], |
222 "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ], |
207 "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995 ], |
223 "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995 ], |
208 "http://lexvo.org/id/iso639-3/bzh" => ['label' => 'Breton', 'count' => 992 ], |
224 "http://lexvo.org/id/iso639-3/bzh" => ['label' => 'Breton', 'count' => 992 ], |
209 "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ], |
225 "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ], |
210 "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ] |
226 "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ] |
211 ]]); |
227 ], "meta" => ['total' => 999]]); |
212 |
228 |
213 } |
229 } |
214 |
230 |
215 public function testIndexLexvo() { |
231 public function testIndexLexvo() { |
216 |
232 |
230 "field" => "subject.label_code", |
246 "field" => "subject.label_code", |
231 "size" => config('corpusparole.theme_default_limit'), |
247 "size" => config('corpusparole.theme_default_limit'), |
232 "order" => [ '_count' => 'desc' ], |
248 "order" => [ '_count' => 'desc' ], |
233 "include" => ".*\|lxv\|.*" |
249 "include" => ".*\|lxv\|.*" |
234 ] |
250 ] |
|
251 ], |
|
252 "subjects_count" => [ |
|
253 "cardinality" => [ |
|
254 "field" => "subject.label_code" |
|
255 ] |
235 ] |
256 ] |
236 ] |
257 ] |
237 ] |
258 ] |
238 ] |
259 ] |
239 ] |
260 ] |
266 "doc_count" => 1002 |
287 "doc_count" => 1002 |
267 ], [ |
288 ], [ |
268 "key" => "Breton|lxv|bzh", |
289 "key" => "Breton|lxv|bzh", |
269 "doc_count" => 992 |
290 "doc_count" => 992 |
270 ] ] |
291 ] ] |
|
292 ], |
|
293 "subjects_count" => [ |
|
294 "value" => 999 |
271 ] |
295 ] |
272 ] |
296 ] |
273 ] |
297 ] |
274 ]); |
298 ]); |
275 $this->get('/api/v1/stats/themes/?filter=lexvo')->assertTrue($this->response->isOk(), $this->response->content()); |
299 $this->get('/api/v1/stats/themes/?filter=lexvo')->assertTrue($this->response->isOk(), $this->response->content()); |
276 $this->seeJsonEquals(["themes" => [ |
300 $this->seeJsonEquals(["themes" => [ |
277 "http://lexvo.org/id/iso639-3/fra" => ['label' => 'Français', 'count' => 1002 ], |
301 "http://lexvo.org/id/iso639-3/fra" => ['label' => 'Français', 'count' => 1002 ], |
278 "http://lexvo.org/id/iso639-3/bzh" => ['label' => 'Breton', 'count' => 992 ] |
302 "http://lexvo.org/id/iso639-3/bzh" => ['label' => 'Breton', 'count' => 992 ] |
279 ]]); |
303 ], "meta" => ['total' => 999]]); |
280 |
304 |
281 } |
305 } |
282 |
306 |
283 private function getOrderQuery($order) { |
307 private function getOrderQuery($order) { |
284 return [ |
308 return [ |
296 "terms" => [ |
320 "terms" => [ |
297 "field" => "subject.label_code", |
321 "field" => "subject.label_code", |
298 "size" => config('corpusparole.theme_default_limit'), |
322 "size" => config('corpusparole.theme_default_limit'), |
299 "order" => $order, |
323 "order" => $order, |
300 "include" => ".*\|bnf\|.*" |
324 "include" => ".*\|bnf\|.*" |
|
325 ] |
|
326 ], |
|
327 "subjects_count" => [ |
|
328 "cardinality" => [ |
|
329 "field" => "subject.label_code" |
301 ] |
330 ] |
302 ] |
331 ] |
303 ] |
332 ] |
304 ] |
333 ] |
305 ] |
334 ] |
327 "doc_count" => 41524, |
356 "doc_count" => 41524, |
328 "subjects" => [ |
357 "subjects" => [ |
329 "doc_count_error_upper_bound" => 0, |
358 "doc_count_error_upper_bound" => 0, |
330 "sum_other_doc_count" => 13678, |
359 "sum_other_doc_count" => 13678, |
331 "buckets" => [ ] |
360 "buckets" => [ ] |
|
361 ], |
|
362 "subjects_count" => [ |
|
363 "value" => 999 |
332 ] |
364 ] |
333 ] |
365 ] |
334 ] |
366 ] |
335 ]; |
367 ]; |
336 } |
368 } |
396 "field" => "subject.label_code", |
428 "field" => "subject.label_code", |
397 "size" => 3, |
429 "size" => 3, |
398 "order" => [ '_count' => 'desc' ], |
430 "order" => [ '_count' => 'desc' ], |
399 "include" => ".*\|bnf\|.*" |
431 "include" => ".*\|bnf\|.*" |
400 ] |
432 ] |
|
433 ], |
|
434 "subjects_count" => [ |
|
435 "cardinality" => [ |
|
436 "field" => "subject.label_code" |
|
437 ] |
401 ] |
438 ] |
402 ] |
439 ] |
403 ] |
440 ] |
404 ] |
441 ] |
405 ] |
442 ] |
451 "doc_count" => 989 |
488 "doc_count" => 989 |
452 ], [ |
489 ], [ |
453 "key" => "arbres|bnf|ark:/12148/cb11934786x", |
490 "key" => "arbres|bnf|ark:/12148/cb11934786x", |
454 "doc_count" => 989 |
491 "doc_count" => 989 |
455 ] ] |
492 ] ] |
|
493 ], |
|
494 "subjects_count" => [ |
|
495 "value" => 999 |
456 ] |
496 ] |
457 ] |
497 ] |
458 ] |
498 ] |
459 ]); |
499 ]); |
460 $this->get('/api/v1/stats/themes/?limit=3')->assertTrue($this->response->isOk(), $this->response->content()); |
500 $this->get('/api/v1/stats/themes/?limit=3')->assertTrue($this->response->isOk(), $this->response->content()); |
461 $this->seeJsonEquals(["themes" => [ |
501 $this->seeJsonEquals(["themes" => [ |
462 "http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ], |
502 "http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ], |
463 "http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ], |
503 "http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ], |
464 "http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ] |
504 "http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ] |
465 ]]); |
505 ], "meta" => ['total' => 999]]); |
466 |
506 |
467 } |
507 } |
468 |
508 |
469 public function testIndexIndex() { |
509 public function testIndexIndex() { |
470 |
510 |
484 "field" => "subject.label_code", |
524 "field" => "subject.label_code", |
485 "size" => 6, |
525 "size" => 6, |
486 "order" => [ '_count' => 'desc' ], |
526 "order" => [ '_count' => 'desc' ], |
487 "include" => ".*\|bnf\|.*" |
527 "include" => ".*\|bnf\|.*" |
488 ] |
528 ] |
|
529 ], |
|
530 "subjects_count" => [ |
|
531 "cardinality" => [ |
|
532 "field" => "subject.label_code" |
|
533 ] |
489 ] |
534 ] |
490 ] |
535 ] |
491 ] |
536 ] |
492 ] |
537 ] |
493 ] |
538 ] |
539 "doc_count" => 989 |
584 "doc_count" => 989 |
540 ], [ |
585 ], [ |
541 "key" => "arbres|bnf|ark:/12148/cb11934786x", |
586 "key" => "arbres|bnf|ark:/12148/cb11934786x", |
542 "doc_count" => 989 |
587 "doc_count" => 989 |
543 ] ] |
588 ] ] |
|
589 ], |
|
590 "subjects_count" => [ |
|
591 "value" => 999 |
544 ] |
592 ] |
545 ] |
593 ] |
546 ] |
594 ] |
547 ]); |
595 ]); |
548 $this->get('/api/v1/stats/themes/?limit=3&index=1')->assertTrue($this->response->isOk(), $this->response->content()); |
596 $this->get('/api/v1/stats/themes/?limit=3&index=1')->assertTrue($this->response->isOk(), $this->response->content()); |
549 $this->seeJsonEquals(["themes" => [ |
597 $this->seeJsonEquals(["themes" => [ |
550 "http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ], |
598 "http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ], |
551 "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ], |
599 "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ], |
552 "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995 ] |
600 "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995 ] |
553 ]]); |
601 ], "meta" => ['total' => 999]]); |
554 |
602 |
555 } |
603 } |
556 |
604 |
557 public function testIndexLimitIndex2() { |
605 public function testIndexLimitIndex2() { |
558 |
606 |
572 "field" => "subject.label_code", |
620 "field" => "subject.label_code", |
573 "size" => 9, |
621 "size" => 9, |
574 "order" => [ '_count' => 'desc' ], |
622 "order" => [ '_count' => 'desc' ], |
575 "include" => ".*\|bnf\|.*" |
623 "include" => ".*\|bnf\|.*" |
576 ] |
624 ] |
|
625 ], |
|
626 "subjects_count" => [ |
|
627 "cardinality" => [ |
|
628 "field" => "subject.label_code" |
|
629 ] |
577 ] |
630 ] |
578 ] |
631 ] |
579 ] |
632 ] |
580 ] |
633 ] |
581 ] |
634 ] |
627 "doc_count" => 989 |
680 "doc_count" => 989 |
628 ], [ |
681 ], [ |
629 "key" => "arbres|bnf|ark:/12148/cb11934786x", |
682 "key" => "arbres|bnf|ark:/12148/cb11934786x", |
630 "doc_count" => 989 |
683 "doc_count" => 989 |
631 ] ] |
684 ] ] |
|
685 ], |
|
686 "subjects_count" => [ |
|
687 "value" => 999 |
632 ] |
688 ] |
633 ] |
689 ] |
634 ] |
690 ] |
635 ]); |
691 ]); |
636 $this->get('/api/v1/stats/themes/?limit=3&index=2')->assertTrue($this->response->isOk(), $this->response->content()); |
692 $this->get('/api/v1/stats/themes/?limit=3&index=2')->assertTrue($this->response->isOk(), $this->response->content()); |
637 $this->seeJsonEquals(["themes" => [ |
693 $this->seeJsonEquals(["themes" => [ |
638 "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ], |
694 "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ], |
639 "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ] |
695 "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ] |
640 ]]); |
696 ], "meta" => ['total' => 999]]); |
641 } |
697 } |
642 |
698 |
643 } |
699 } |