Example #1
0
 public function scheduleRecordsFromCollectionForIndexing(\collection $collection)
 {
     RecordQueuer::queueRecordsFromCollection($collection);
 }
Example #2
0
 /**
  * Index a list of records
  *
  * @param BulkOperation $bulk
  * @param Iterator $records
  */
 public function index(BulkOperation $bulk, Iterator $records)
 {
     foreach ($this->createFetchersForRecords($records) as $fetcher) {
         $submited_records = [];
         $databox = $fetcher->getDatabox();
         // post fetch : flag records as "indexing"
         $fetcher->setPostFetch(function (array $records) use($fetcher, $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);
         });
         // Perform indexing
         $this->indexFromFetcher($bulk, $fetcher, $submited_records);
     }
 }