Skip to content

Commit 54b8d2a

Browse files
committed
Cleanups
1 parent 083af67 commit 54b8d2a

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/Scout/ScoutEngine.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,10 @@ public function createIndex($name, array $options = []): void
394394

395395
// Ensure the collection exists before creating the search index
396396
$this->mongodb->createCollection($name);
397-
$collection = $this->mongodb->selectCollection($name);
398397

399398
$collection = $this->mongodb->selectCollection($name);
400-
/** @todo accept configuration for the mapping */
401399
$collection->createSearchIndex(
402-
$options['definition'] ?? self::DEFAULT_DEFINITION,
400+
self::DEFAULT_DEFINITION,
403401
['name' => self::INDEX_NAME],
404402
);
405403

@@ -410,14 +408,7 @@ public function createIndex($name, array $options = []): void
410408
'typeMap' => ['root' => 'bson'],
411409
]);
412410

413-
// Many indexes with the same name may exist on Atlas local
414-
foreach ($indexes as $index) {
415-
if ($index->name === self::INDEX_NAME && $index->status === 'READY') {
416-
return true;
417-
}
418-
}
419-
420-
return false;
411+
return $indexes->current() && $indexes->current()->status === 'READY';
421412
});
422413
}
423414
}

0 commit comments

Comments
 (0)