chore: clean up buildcommand
This commit is contained in:
parent
db74da3e37
commit
508bb42ac9
|
|
@ -36,7 +36,8 @@ class BuildCommand extends Command
|
||||||
{--recreate : create or recreate the index}
|
{--recreate : create or recreate the index}
|
||||||
{--mapping : recreate the mapping}
|
{--mapping : recreate the mapping}
|
||||||
{--continue : continue each object type where you left off}
|
{--continue : continue each object type where you left off}
|
||||||
{--seed-missing : attempt to seed objects that are missing in the index}';
|
{--seed-missing : attempt to seed only objects that are missing in the index}';
|
||||||
|
|
||||||
protected $description = 'Rebuilds the complete search server with its documents.';
|
protected $description = 'Rebuilds the complete search server with its documents.';
|
||||||
|
|
||||||
public function handle(Container $container)
|
public function handle(Container $container)
|
||||||
|
|
@ -56,6 +57,7 @@ class BuildCommand extends Command
|
||||||
/** @var SettingsRepositoryInterface $settings */
|
/** @var SettingsRepositoryInterface $settings */
|
||||||
$settings = $container->make(SettingsRepositoryInterface::class);
|
$settings = $container->make(SettingsRepositoryInterface::class);
|
||||||
|
|
||||||
|
// Elastic scheme definition.
|
||||||
$properties = [
|
$properties = [
|
||||||
'properties' => [
|
'properties' => [
|
||||||
'content' => ['type' => 'text', 'analyzer' => 'flarum_analyzer_partial', 'search_analyzer' => 'flarum_analyzer'],
|
'content' => ['type' => 'text', 'analyzer' => 'flarum_analyzer_partial', 'search_analyzer' => 'flarum_analyzer'],
|
||||||
|
|
@ -72,6 +74,7 @@ class BuildCommand extends Command
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Remove/delete the whole index.
|
||||||
if ($this->option('recreate')) {
|
if ($this->option('recreate')) {
|
||||||
// Flush the index.
|
// Flush the index.
|
||||||
$client->indices()->delete([
|
$client->indices()->delete([
|
||||||
|
|
@ -113,6 +116,7 @@ class BuildCommand extends Command
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the index.
|
||||||
if ($this->option('recreate') || $this->option('mapping')) {
|
if ($this->option('recreate') || $this->option('mapping')) {
|
||||||
$client->indices()->putMapping([
|
$client->indices()->putMapping([
|
||||||
'index' => $index,
|
'index' => $index,
|
||||||
|
|
@ -120,6 +124,7 @@ class BuildCommand extends Command
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Seed only a specific resource.
|
||||||
$only = $this->option('only');
|
$only = $this->option('only');
|
||||||
|
|
||||||
/** @var Seeder $seeder */
|
/** @var Seeder $seeder */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue