/** * Add or update the given searchable subject to the index. * * @param Searchable $subject */ public function upsertToIndex(Searchable $subject) { $this->index->saveObject(array_merge($subject->getSearchableBody(), ['objectID' => $this->getAlgoliaId($subject)])); }
public function it_adds_a_searchable_object_to_the_search_index(\AlgoliaSearch\Index $index, Searchable $searchableObject) { $index->saveObject(array_merge($this->searchableBody, ['objectID' => $this->searchableType . '-' . $this->searchableId]))->shouldBeCalled(); $this->upsertToIndex($searchableObject); }