diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/RecordIndexer.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/RecordIndexer.php index f39959cece..84bcfe64f7 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/RecordIndexer.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/RecordIndexer.php @@ -111,25 +111,25 @@ class RecordIndexer public function populateIndex(BulkOperation $bulk, array $databoxes) { foreach ($databoxes as $databox) { - $submited_records = []; + $submitted_records = []; $this->logger->info(sprintf('Indexing database %s...', $databox->get_viewname())); $fetcher = $this->createFetcherForDatabox($databox); // no delegate, scan the whole records // post fetch : flag records as "indexing" - $fetcher->setPostFetch(function(array $records) use ($databox, $fetcher) { + $fetcher->setPostFetch(function(array $records) use ($databox) { RecordQueuer::didStartIndexingRecords($records, $databox); // do not restart the fetcher since it has no clause on jetons }); // bulk flush : flag records as "indexed" - $bulk->onFlush(function($operation_identifiers) use ($databox, &$submited_records) { - $this->onBulkFlush($databox, $operation_identifiers, $submited_records); + $bulk->onFlush(function($operation_identifiers) use ($databox, &$submitted_records) { + $this->onBulkFlush($databox, $operation_identifiers, $submitted_records); }); // Perform indexing - $this->indexFromFetcher($bulk, $fetcher, $submited_records); + $this->indexFromFetcher($bulk, $fetcher, $submitted_records); $this->logger->info(sprintf('Finished indexing %s', $databox->get_viewname())); } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/RecordQueuer.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/RecordQueuer.php index 7251988fe2..86c3992ff1 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/RecordQueuer.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/RecordQueuer.php @@ -44,13 +44,13 @@ class RecordQueuer } /** - * @param array $records - * @param $databox + * @param array $records + * @param databox $databox * * nb: changing the jeton may affect a fetcher if his "where" clause (delegate) depends on jeton. * in this case the client of the fetcher must set a "postFetch" callback and restart the fetcher */ - public static function didStartIndexingRecords(array $records, $databox) + public static function didStartIndexingRecords(array $records, databox $databox) { $connection = $databox->get_connection(); $sql = "UPDATE record SET jeton = (jeton | :flag) WHERE record_id IN (:record_ids)"; @@ -76,14 +76,14 @@ class RecordQueuer { return $connection->executeQuery($sql, array( ':flag' => $flag, - ':record_ids' => self::array_pluck($records, 'record_id') + ':record_ids' => self::arrayPluck($records, 'record_id') ), array( ':flag' => PDO::PARAM_INT, ':record_ids' => Connection::PARAM_INT_ARRAY )); } - private static function array_pluck(array $array, $key) + private static function arrayPluck(array $array, $key) { $values = array(); foreach ($array as $item) { diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php index 9ac4593523..a4d21c6721 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php @@ -876,10 +876,17 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase self::$DI['record_story_1']; - self::$DI['client']->request('POST', '/api/v1/search/', $this->getParameters(['search_type' => SearchEngineOptions::RECORD_GROUPING]), [], ['HTTP_Accept' => $this->getAcceptMimeType()]); - $content = $this->unserialize(self::$DI['client']->getResponse()->getContent()); + $client = $this->getClient(); + $client->request( + 'POST', + '/api/v1/search/', + $this->getParameters(['search_type' => SearchEngineOptions::RECORD_GROUPING]), + [], + ['HTTP_Accept' => $this->getAcceptMimeType()] + ); + $content = $this->unserialize($client->getResponse()->getContent()); - $this->evaluateResponse200(self::$DI['client']->getResponse()); + $this->evaluateResponse200($client->getResponse()); $this->evaluateMeta200($content); $response = $content['response'];