clearIndex() public method

This function deletes the index content. Settings and index specific API keys are kept untouched.
public clearIndex ( ) : mixed
return mixed
 /**
  * {@inheritDoc}
  */
 public function synchronize(array $documents)
 {
     if ($this->clearOnSync) {
         $this->index->clearIndex();
     }
     $this->index->addObjects($documents);
 }
Esempio n. 2
0
 /**
  * @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);
 }
Esempio n. 3
0
 /**
  * Remove everything from the index.
  *
  * @return mixed
  */
 public function clearIndex()
 {
     $this->index->clearIndex();
 }
Esempio n. 4
0
 public function it_can_clear_the_index(\AlgoliaSearch\Index $index)
 {
     $index->clearIndex()->shouldBeCalled();
     $this->clearIndex();
 }