Skip to content

Commit

Permalink
Separate methods for clearing and dropping an index
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Daun <post@philippdaun.net>
  • Loading branch information
daun committed Jan 17, 2025
1 parent 2e48b0f commit 064bacf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Loupe/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ protected function createIndex()

protected function resetIndex()
{
$this->deleteIndex();
$this->createIndex();
$this->manager->clearIndex($this->name);
}

public function extraAugmentedResultData(Result $result)
Expand Down
6 changes: 5 additions & 1 deletion src/Loupe/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ public function createIndex(string $index): void
}

public function dropIndex(string $index): void
{
$this->filesystem->cleanDirectory($this->indexDirectory($index));
}

public function clearIndex(string $index): void
{
$this->get($index, Configuration::create())->deleteAllDocuments();
// $this->filesystem->cleanDirectory($this->indexDirectory($index));
}

public function indexDirectory(string $index): string
Expand Down

0 comments on commit 064bacf

Please sign in to comment.