-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for correct full rebuilding of search index.
Remove index directory after each test.
- Loading branch information
Showing
9 changed files
with
130 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php namespace Nqxcode\LuceneSearch\Job; | ||
|
||
use File; | ||
use Nqxcode\LuceneSearch\Support\SearchIndexRotator; | ||
|
||
/** | ||
* Class RotateSearchIndex | ||
* @package Nqxcode\LuceneSearch\Job | ||
*/ | ||
class RotateSearchIndex | ||
{ | ||
public function fire($job, array $jobData) | ||
{ | ||
app('search.index.rotator')->rotate(); | ||
|
||
$job->delete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php namespace Nqxcode\LuceneSearch\Support; | ||
|
||
use File; | ||
|
||
/** | ||
* Class SearchIndexRotator | ||
* @package Nqxcode\LuceneSearch\Support | ||
*/ | ||
class SearchIndexRotator | ||
{ | ||
private $currentIndexPath; | ||
private $newIndexPath; | ||
private $previewIndexPath; | ||
|
||
public function __construct($currentPath, $newPath, $previewPath) | ||
{ | ||
$this->currentIndexPath = $currentPath; | ||
$this->newIndexPath = $newPath; | ||
$this->previewIndexPath = $previewPath; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getNewIndexPath() | ||
{ | ||
return $this->newIndexPath; | ||
} | ||
|
||
public function rotate() | ||
{ | ||
File::deleteDirectory($this->previewIndexPath); | ||
|
||
File::copyDirectory($this->currentIndexPath, $this->previewIndexPath); | ||
File::cleanDirectory($this->currentIndexPath); | ||
|
||
File::copyDirectory($this->newIndexPath, $this->currentIndexPath); | ||
File::deleteDirectory($this->newIndexPath); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters