server/src/tests/Controllers/ThemeControllerTest.php
author ymh <ymh.work@gmail.com>
Thu, 03 Nov 2016 01:52:26 +0100
changeset 387 7fba86fa8604
parent 322 084aae09edf4
child 407 2dba812c7ef2
permissions -rw-r--r--
Sparql client implementation
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' =>[
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    31
                    'match_all' => []
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
                                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    44
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    45
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    46
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    47
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    48
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    49
        ];
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    51
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    52
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    53
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    54
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    55
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    56
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    57
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    58
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    59
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    60
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    61
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    62
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    63
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    64
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    65
                    "hits" => [ ]
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
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    68
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    69
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    70
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    71
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    72
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    73
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    74
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    75
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    76
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    77
                                "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
    78
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    79
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    80
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    81
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    82
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    83
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    84
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    85
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    86
                                "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
    87
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    88
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    89
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    90
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    91
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    92
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    93
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    94
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    95
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    96
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    97
                            ] ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    98
                        ]
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
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   101
            ]);
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   102
        $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
   103
        $this->seeJsonEquals(["themes" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   104
            "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
   105
            "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
   106
            "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
   107
            "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
   108
            "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
   109
            "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
   110
            "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
   111
            "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   112
        ]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   116
    public function testIndexAll() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   117
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   118
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   119
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   120
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   121
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   122
                'query' =>[
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   123
                    'match_all' => []
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   124
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   125
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   126
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   127
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   128
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   129
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   130
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   131
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   132
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   133
                                    "order" => [ '_count' => 'desc' ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   134
                                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   135
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   136
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   137
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   138
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   139
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   140
        ];
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   142
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   143
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   144
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   145
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   146
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   147
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   148
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   149
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   150
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   151
                    "failed" => 0
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
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   154
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   155
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   156
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   157
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   158
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   159
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   160
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   161
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   162
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   163
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   164
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   165
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   166
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   167
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   168
                                "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
   169
                                "doc_count" => 1092
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
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   172
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   173
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   174
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   175
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   176
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   177
                                "key" => "Français|lxv|fra",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   178
                                "doc_count" => 1002
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   179
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   180
                                "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
   181
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   182
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   183
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   184
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   185
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   186
                                "key" => "Breton|lxv|bzh",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   187
                                "doc_count" => 992
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   188
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   189
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   190
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   191
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   192
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   193
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   194
                            ] ]
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
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   197
                ]
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
        $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
   200
        $this->seeJsonEquals(["themes" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   201
            "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
   202
            "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
   203
            "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
   204
            "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
   205
            "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
   206
            "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
   207
            "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
   208
            "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
   209
            "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
   210
            "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   211
        ]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   215
    public function testIndexLexvo() {
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   217
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   218
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   219
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   220
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   221
                'query' =>[
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   222
                    'match_all' => []
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   223
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   224
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   225
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   226
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   227
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   228
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   229
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   230
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   231
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   232
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   233
                                    "include" => ".*\|lxv\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   234
                                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   235
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   236
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   237
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   238
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   239
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   240
        ];
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   241
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   242
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   243
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   244
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   245
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   246
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   247
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   248
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   249
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   250
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   251
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   252
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   253
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   254
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   255
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   256
                    "hits" => [ ]
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
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   259
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   260
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   261
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   262
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   263
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   264
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   265
                                "key" => "Français|lxv|fra",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   266
                                "doc_count" => 1002
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   267
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   268
                                "key" => "Breton|lxv|bzh",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   269
                                "doc_count" => 992
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   270
                            ] ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   271
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   272
                    ]
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
            ]);
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   275
        $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
   276
        $this->seeJsonEquals(["themes" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   277
            "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
   278
            "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
   279
        ]]);
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   280
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   281
    }
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   283
    private function getOrderQuery($order) {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   284
        return [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   285
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   286
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   287
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   288
                'query' =>[
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   289
                    'match_all' => []
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   290
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   291
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   292
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   293
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   294
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   295
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   296
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   297
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   298
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   299
                                    "order" => $order,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   300
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   301
                                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   302
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   303
                        ]
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
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   306
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   307
        ];
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   308
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   309
    }
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   310
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   311
    private function getRespSort() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   312
        return [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   313
            "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   314
            "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   315
            "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   316
                "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   317
                "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   318
                "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   319
            ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   320
            "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   321
                "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   322
                "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   323
                "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   324
            ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   325
            "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   326
                "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   327
                    "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   328
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   329
                        "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   330
                        "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   331
                        "buckets" => [  ]
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
    public function testIndexSort() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   339
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   340
        Es::shouldReceive('search')
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   341
            ->once()
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   342
            ->with($this->getOrderQuery(['_count' => 'desc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   343
            ->andReturn($this->getRespSort());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   344
        $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
   345
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   346
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   347
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   348
    public function testIndexSortReverseCount() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   349
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   350
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   351
            ->with($this->getOrderQuery(['_count' => 'asc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   352
            ->andReturn($this->getRespSort());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   353
        $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
   354
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   355
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   356
    public function testIndexSortLabel() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   357
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   358
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   359
            ->with($this->getOrderQuery(['_term' => 'asc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   360
            ->andReturn($this->getRespSort());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   361
        $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
   362
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   363
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   364
    public function testIndexSortAlphabetical() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   365
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   366
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   367
            ->with($this->getOrderQuery(['_term' => 'asc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   368
            ->andReturn($this->getRespSort());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   369
        $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
   370
    }
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
    public function testIndexSortLabelReverse() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   373
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   374
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   375
            ->with($this->getOrderQuery(['_term' => 'desc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   376
            ->andReturn($this->getRespSort());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   377
        $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
   378
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   379
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   380
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   381
    public function testIndexLimit() {
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   382
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   383
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   384
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   385
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   386
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   387
                'query' =>[
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   388
                    'match_all' => []
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   389
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   390
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   391
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   392
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   393
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   394
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   395
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   396
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   397
                                    "size" => 3,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   398
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   399
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   400
                                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   401
                            ]
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
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   405
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   406
        ];
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   407
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   408
        // 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
   409
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   410
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   411
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   412
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   413
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   414
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   415
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   416
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   417
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   418
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   419
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   420
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   421
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   422
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   423
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   424
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   425
                "aggregations" => [
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
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   428
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   429
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   430
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   431
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   432
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   433
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   434
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   435
                                "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
   436
                                "doc_count" => 1092
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
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   439
                                "doc_count" => 1050
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
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   442
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   443
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   444
                                "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
   445
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   446
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   447
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   448
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   449
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   450
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   451
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   452
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   453
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   454
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   455
                            ] ]
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
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   458
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   459
            ]);
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   460
        $this->get('/api/v1/stats/themes/?limit=3')->assertTrue($this->response->isOk(), $this->response->content());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   461
        $this->seeJsonEquals(["themes" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   462
            "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
   463
            "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
   464
            "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
   465
        ]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   466
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   467
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   468
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   469
    public function testIndexIndex() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   470
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   471
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   472
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   473
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   474
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   475
                'query' =>[
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   476
                    'match_all' => []
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   477
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   478
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   479
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   480
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   481
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   482
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   483
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   484
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   485
                                    "size" => 6,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   486
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   487
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   488
                                ]
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
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   491
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   492
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   493
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   494
        ];
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   495
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   496
        // 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
   497
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   498
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   499
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   500
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   501
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   502
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   503
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   504
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   505
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   506
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   507
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   508
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   509
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   510
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   511
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   512
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   513
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   514
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   515
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   516
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   517
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   518
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   519
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   520
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   521
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   522
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   523
                                "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
   524
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   525
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   526
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   527
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   528
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   529
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   530
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   531
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   532
                                "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
   533
                                "doc_count" => 1001
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
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   536
                                "doc_count" => 995
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
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   539
                                "doc_count" => 989
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
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   542
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   543
                            ] ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   544
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   545
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   546
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   547
            ]);
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   548
        $this->get('/api/v1/stats/themes/?limit=3&index=1')->assertTrue($this->response->isOk(), $this->response->content());
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   549
        $this->seeJsonEquals(["themes" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   550
            "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
   551
            "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
   552
            "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
   553
        ]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   554
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   555
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   556
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   557
    public function testIndexLimitIndex2() {
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   558
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   559
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   560
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   561
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   562
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   563
                'query' =>[
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   564
                    'match_all' => []
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   565
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   566
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   567
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   568
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   569
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   570
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   571
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   572
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   573
                                    "size" => 9,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   574
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   575
                                    "include" => ".*\|bnf\|.*"
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
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   578
                        ]
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
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   581
            ]
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
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   584
        // 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
   585
        Es::shouldReceive('search')
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   586
            ->once()
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   587
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   588
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   589
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   590
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   591
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   592
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   593
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   594
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   595
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   596
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   597
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   598
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   599
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   600
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   601
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   602
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   603
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   604
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   605
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   606
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   607
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   608
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   609
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   610
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   611
                                "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
   612
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   613
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   614
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   615
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   616
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   617
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   618
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   619
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   620
                                "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
   621
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   622
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   623
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   624
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   625
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   626
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   627
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   628
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   629
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   630
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   631
                            ] ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   632
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   633
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   634
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   635
            ]);
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   636
        $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
   637
        $this->seeJsonEquals(["themes" => [
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   638
            "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
   639
            "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ]
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   640
        ]]);
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   641
    }
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   642
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   643
}