/** * {@inheritDoc} */ public function synchronize(array $documents) { if ($this->clearOnSync) { $this->index->clearIndex(); } $this->index->addObjects($documents); }
/** * @param \Sculpin\Core\Event\SourceSetEvent $event */ public function afterRun(SourceSetEvent $event) { $documents = array(); /** @var AbstractSource $item */ foreach ($event->allSources() as $item) { if ($item->data()->get('indexed')) { if ($item->isGenerated()) { continue; } $documents[] = $this->parseSource($item); } } $this->index->clearIndex(); $this->index->addObjects($documents); }
/** * Remove everything from the index. * * @return mixed */ public function clearIndex() { $this->index->clearIndex(); }
public function it_can_clear_the_index(\AlgoliaSearch\Index $index) { $index->clearIndex()->shouldBeCalled(); $this->clearIndex(); }