server/src/tests/Controllers/ThemeControllerTest.php
author ymh <ymh.work@gmail.com>
Wed, 15 Feb 2017 10:51:26 +0100
changeset 510 b4ed4ae6a6dc
parent 474 245b4df137d3
child 537 d2e6ee099125
permissions -rw-r--r--
Added tag 0.0.16 for changeset fcc59d0ac8aa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
use Mockery as m;
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
use EasyRdf\Resource;
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
use EasyRdf\Literal;
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
/**
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 *
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 */
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
class ThemeControllerTest extends TestCase {
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
    public function setUp() {
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
        parent::setup();
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
    public function tearDown() {
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
        m::close();
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
        parent::tearDown();
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    24
    public function testIndex() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    25
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    26
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    27
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    28
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    29
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    30
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
    31
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    32
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    33
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    34
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    35
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    36
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    37
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    38
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    39
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    40
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    41
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    42
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    43
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
    44
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
    45
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
    46
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
    47
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
    48
                                ]
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    49
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    50
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    51
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    52
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    53
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    54
        ];
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    56
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    57
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    58
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    59
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    60
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    61
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    62
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    63
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    64
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    65
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    66
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    67
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    68
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    69
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    70
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    71
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    72
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    73
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    74
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    75
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    76
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    77
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    78
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    79
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    80
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    81
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    82
                                "key" => "travail non rémunéré|bnf|ark:/12148/cb16604691s",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    83
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    84
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    85
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    86
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    87
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    88
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    89
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    90
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    91
                                "key" => "météorologie|bnf|ark:/12148/cb11932496x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    92
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    93
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    94
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    95
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    96
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    97
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    98
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    99
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   100
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   101
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   102
                            ] ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   103
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   104
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   105
                            "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   106
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   107
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   108
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   109
            ]);
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   110
        $this->get('/api/v1/stats/themes/')->assertTrue($this->response->isOk(), $this->response->content());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   111
        $this->seeJsonEquals(["themes" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   112
            "http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   113
            "http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   114
            "http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   115
            "http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   116
            "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   117
            "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995  ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   118
            "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   119
            "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   120
        ], "meta" => ['total' => 999]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   124
    public function testIndexAll() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   125
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   126
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   127
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   128
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   129
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   130
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
   131
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   132
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   133
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   134
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   135
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   136
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   137
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   138
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   139
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   140
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   141
                                    "order" => [ '_count' => 'desc' ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   142
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   143
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   144
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   145
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   146
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   147
                                ]
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   148
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   149
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   150
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   151
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   152
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   153
        ];
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   155
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   156
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   157
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   158
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   159
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   160
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   161
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   162
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   163
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   164
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   165
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   166
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   167
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   168
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   169
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   170
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   171
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   172
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   173
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   174
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   175
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   176
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   177
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   178
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   179
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   180
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   181
                                "key" => "travail non rémunéré|bnf|ark:/12148/cb16604691s",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   182
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   183
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   184
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   185
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   186
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   187
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   188
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   189
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   190
                                "key" => "Français|lxv|fra",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   191
                                "doc_count" => 1002
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   192
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   193
                                "key" => "météorologie|bnf|ark:/12148/cb11932496x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   194
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   195
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   196
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   197
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   198
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   199
                                "key" => "Breton|lxv|bzh",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   200
                                "doc_count" => 992
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   201
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   202
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   203
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   204
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   205
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   206
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   207
                            ] ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   208
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   209
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   210
                            "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   211
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   212
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   213
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   214
            ]);
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   215
        $this->get('/api/v1/stats/themes/?filter=all')->assertTrue($this->response->isOk(), $this->response->content());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   216
        $this->seeJsonEquals(["themes" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   217
            "http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   218
            "http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   219
            "http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   220
            "http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   221
            "http://lexvo.org/id/iso639-3/fra" => ['label' => 'Français', 'count' => 1002 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   222
            "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   223
            "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995  ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   224
            "http://lexvo.org/id/iso639-3/bzh" => ['label' => 'Breton', 'count' => 992 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   225
            "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   226
            "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   227
        ], "meta" => ['total' => 999]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   231
    public function testIndexLexvo() {
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   233
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   234
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   235
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   236
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   237
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
   238
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   239
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   240
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   241
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   242
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   243
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   244
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   245
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   246
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   247
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   248
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   249
                                    "include" => ".*\|lxv\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   250
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   251
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   252
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   253
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   254
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   255
                                ]
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   256
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   257
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   258
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   259
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   260
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   261
        ];
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   262
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   263
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   264
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   265
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   266
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   267
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   268
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   269
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   270
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   271
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   272
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   273
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   274
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   275
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   276
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   277
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   278
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   279
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   280
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   281
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   282
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   283
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   284
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   285
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   286
                                "key" => "Français|lxv|fra",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   287
                                "doc_count" => 1002
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   288
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   289
                                "key" => "Breton|lxv|bzh",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   290
                                "doc_count" => 992
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   291
                            ] ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   292
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   293
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   294
                            "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   295
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   296
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   297
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   298
            ]);
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   299
        $this->get('/api/v1/stats/themes/?filter=lexvo')->assertTrue($this->response->isOk(), $this->response->content());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   300
        $this->seeJsonEquals(["themes" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   301
            "http://lexvo.org/id/iso639-3/fra" => ['label' => 'Français', 'count' => 1002 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   302
            "http://lexvo.org/id/iso639-3/bzh" => ['label' => 'Breton', 'count' => 992 ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   303
        ], "meta" => ['total' => 999]]);
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   304
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   305
    }
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   307
    private function getOrderQuery($order) {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   308
        return [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   309
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   310
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   311
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   312
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
   313
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   314
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   315
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   316
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   317
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   318
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   319
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   320
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   321
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   322
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   323
                                    "order" => $order,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   324
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   325
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   326
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   327
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   328
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   329
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   330
                                ]
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   331
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   332
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   333
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   334
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   335
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   336
        ];
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   337
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   338
    }
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   339
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   340
    private function getRespSort() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   341
        return [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   342
            "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   343
            "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   344
            "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   345
                "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   346
                "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   347
                "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   348
            ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   349
            "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   350
                "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   351
                "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   352
                "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   353
            ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   354
            "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   355
                "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   356
                    "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   357
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   358
                        "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   359
                        "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   360
                        "buckets" => [  ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   361
                    ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   362
                    "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   363
                        "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   364
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   365
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   366
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   367
        ];
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   368
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   369
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   370
    public function testIndexSort() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   371
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   372
        Es::shouldReceive('search')
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   373
            ->once()
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   374
            ->with($this->getOrderQuery(['_count' => 'desc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   375
            ->andReturn($this->getRespSort());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   376
        $this->get('/api/v1/stats/themes/')->assertTrue($this->response->isOk(), $this->response->content());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   377
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   378
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   379
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   380
    public function testIndexSortReverseCount() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   381
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   382
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   383
            ->with($this->getOrderQuery(['_count' => 'asc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   384
            ->andReturn($this->getRespSort());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   385
        $this->get('/api/v1/stats/themes/?sort=-count')->assertTrue($this->response->isOk(), $this->response->content());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   386
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   387
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   388
    public function testIndexSortLabel() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   389
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   390
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   391
            ->with($this->getOrderQuery(['_term' => 'asc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   392
            ->andReturn($this->getRespSort());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   393
        $this->get('/api/v1/stats/themes/?sort=label')->assertTrue($this->response->isOk(), $this->response->content());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   394
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   395
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   396
    public function testIndexSortAlphabetical() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   397
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   398
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   399
            ->with($this->getOrderQuery(['_term' => 'asc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   400
            ->andReturn($this->getRespSort());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   401
        $this->get('/api/v1/stats/themes/?sort=alphabetical')->assertTrue($this->response->isOk(), $this->response->content());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   402
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   403
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   404
    public function testIndexSortLabelReverse() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   405
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   406
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   407
            ->with($this->getOrderQuery(['_term' => 'desc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   408
            ->andReturn($this->getRespSort());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   409
        $this->get('/api/v1/stats/themes/?sort=-label')->assertTrue($this->response->isOk(), $this->response->content());
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   410
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   411
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   412
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   413
    public function testIndexLimit() {
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   414
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   415
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   416
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   417
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   418
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   419
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
   420
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   421
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   422
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   423
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   424
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   425
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   426
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   427
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   428
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   429
                                    "size" => 3,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   430
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   431
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   432
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   433
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   434
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   435
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   436
                                    "field" => "subject.label_code"
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   437
                                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   438
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   439
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   440
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   441
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   442
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   443
        ];
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   444
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   445
        // This is not normally what should be received, but we test that the limit is respected
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   446
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   447
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   448
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   449
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   450
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   451
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   452
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   453
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   454
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   455
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   456
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   457
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   458
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   459
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   460
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   461
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   462
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   463
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   464
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   465
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   466
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   467
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   468
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   469
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   470
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   471
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   472
                                "key" => "travail non rémunéré|bnf|ark:/12148/cb16604691s",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   473
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   474
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   475
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   476
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   477
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   478
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   479
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   480
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   481
                                "key" => "météorologie|bnf|ark:/12148/cb11932496x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   482
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   483
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   484
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   485
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   486
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   487
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   488
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   489
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   490
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   491
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   492
                            ] ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   493
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   494
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   495
                            "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   496
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   497
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   498
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   499
            ]);
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   500
        $this->get('/api/v1/stats/themes/?limit=3')->assertTrue($this->response->isOk(), $this->response->content());
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   501
        $this->seeJsonEquals(["themes" => [
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   502
            "http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   503
            "http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   504
            "http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   505
        ], "meta" => ['total' => 999]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   506
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   507
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   508
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   509
    public function testIndexIndex() {
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   510
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   511
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   512
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   513
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   514
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   515
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
   516
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   517
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   518
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   519
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   520
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   521
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   522
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   523
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   524
                                    "field" => "subject.label_code",
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   525
                                    "size" => 6,
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   526
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   527
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   528
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   529
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   530
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   531
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   532
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   533
                                ]
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   534
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   535
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   536
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   537
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   538
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   539
        ];
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   540
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   541
        // This is not normally what should be received, but we test that the limit is respected
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   542
        Es::shouldReceive('search')
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   543
            ->once()
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   544
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   545
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   546
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   547
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   548
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   549
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   550
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   551
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   552
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   553
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   554
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   555
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   556
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   557
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   558
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   559
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   560
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   561
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   562
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   563
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   564
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   565
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   566
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   567
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   568
                                "key" => "travail non rémunéré|bnf|ark:/12148/cb16604691s",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   569
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   570
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   571
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   572
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   573
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   574
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   575
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   576
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   577
                                "key" => "météorologie|bnf|ark:/12148/cb11932496x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   578
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   579
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   580
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   581
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   582
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   583
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   584
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   585
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   586
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   587
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   588
                            ] ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   589
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   590
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   591
                            "value" => 999
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   592
                        ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   593
                    ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   594
                ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   595
            ]);
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   596
        $this->get('/api/v1/stats/themes/?limit=3&index=1')->assertTrue($this->response->isOk(), $this->response->content());
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   597
        $this->seeJsonEquals(["themes" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   598
            "http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   599
            "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   600
            "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995  ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   601
        ], "meta" => ['total' => 999]]);
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   602
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   603
    }
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   604
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   605
    public function testIndexLimitIndex2() {
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   606
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   607
        $query = [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   608
            'index' => env('ELASTICSEARCH_INDEX'),
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   609
            'body' => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   610
                'size' => 0,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   611
                'query' =>[
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   612
                    'match_all' => (object) null
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   613
                ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   614
                'aggs' => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   615
                    "subjects" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   616
                        "nested" => [ "path" => "subject" ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   617
                        "aggs" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   618
                            "subjects" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   619
                                "terms" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   620
                                    "field" => "subject.label_code",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   621
                                    "size" => 9,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   622
                                    "order" => [ '_count' => 'desc' ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   623
                                    "include" => ".*\|bnf\|.*"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   624
                                ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   625
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   626
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   627
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   628
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   629
                                ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   630
                            ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   631
                        ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   632
                    ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   633
                ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   634
            ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   635
        ];
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   636
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   637
        // This is not normally what should be received, but we test that the limit is respected
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   638
        Es::shouldReceive('search')
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   639
            ->once()
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   640
            ->with($query)
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   641
            ->andReturn([
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   642
                "took" => 27,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   643
                "timed_out" => false,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   644
                "_shards" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   645
                    "total" => 1,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   646
                    "successful" => 1,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   647
                    "failed" => 0
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   648
                ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   649
                "hits" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   650
                    "total" => 3011,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   651
                    "max_score" => 0.0,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   652
                    "hits" => [ ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   653
                ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   654
                "aggregations" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   655
                    "subjects" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   656
                        "doc_count" => 41524,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   657
                        "subjects" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   658
                            "doc_count_error_upper_bound" => 0,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   659
                            "sum_other_doc_count" => 13678,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   660
                            "buckets" => [ [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   661
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   662
                                "doc_count" => 1412
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   663
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   664
                                "key" => "travail non rémunéré|bnf|ark:/12148/cb16604691s",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   665
                                "doc_count" => 1092
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   666
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   667
                                "key" => "famille|bnf|ark:/12148/cb119339867",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   668
                                "doc_count" => 1050
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   669
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   670
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   671
                                "doc_count" => 1003
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   672
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   673
                                "key" => "météorologie|bnf|ark:/12148/cb11932496x",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   674
                                "doc_count" => 1001
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   675
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   676
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   677
                                "doc_count" => 995
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   678
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   679
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   680
                                "doc_count" => 989
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   681
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   682
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   683
                                "doc_count" => 989
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   684
                            ] ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   685
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   686
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   687
                            "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   688
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   689
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   690
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   691
            ]);
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   692
        $this->get('/api/v1/stats/themes/?limit=3&index=2')->assertTrue($this->response->isOk(), $this->response->content());
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   693
        $this->seeJsonEquals(["themes" => [
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   694
            "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   695
            "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   696
        ], "meta" => ['total' => 999]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   697
    }
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   698
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   699
}