mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Use \Elasticsearch
This commit is contained in:
@@ -1045,7 +1045,7 @@ class NameFixer
|
||||
'id' => $release->releases_id,
|
||||
];
|
||||
|
||||
Elasticsearch::update($data);
|
||||
\Elasticsearch::update($data);
|
||||
} else {
|
||||
$this->sphinx->updateRelease($release->releases_id);
|
||||
}
|
||||
@@ -1089,7 +1089,7 @@ class NameFixer
|
||||
'id' => $release->releases_id,
|
||||
];
|
||||
|
||||
Elasticsearch::update($data);
|
||||
\Elasticsearch::update($data);
|
||||
}
|
||||
} else {
|
||||
$this->sphinx->updateRelease($release->releases_id);
|
||||
|
||||
@@ -1198,7 +1198,7 @@ class ProcessAdditional
|
||||
'id' => $this->_release->id,
|
||||
];
|
||||
|
||||
Elasticsearch::update($data);
|
||||
\Elasticsearch::update($data);
|
||||
}
|
||||
} else {
|
||||
$this->sphinx->updateRelease($this->_release->id);
|
||||
@@ -1775,7 +1775,7 @@ class ProcessAdditional
|
||||
'id' => $this->_release->id,
|
||||
];
|
||||
|
||||
Elasticsearch::update($data);
|
||||
\Elasticsearch::update($data);
|
||||
} else {
|
||||
$this->sphinx->updateRelease($this->_release->id);
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ class NntmuxResetDb extends Command
|
||||
$this->info('Truncating completed.');
|
||||
|
||||
if (config('nntmux.elasticsearch_enabled') === true) {
|
||||
if (Elasticsearch::indices()->exists(['index' => 'releases'])) {
|
||||
Elasticsearch::indices()->delete(['index' => 'releases']);
|
||||
if (\Elasticsearch::indices()->exists(['index' => 'releases'])) {
|
||||
\Elasticsearch::indices()->delete(['index' => 'releases']);
|
||||
}
|
||||
$releases_index = [
|
||||
'index' => 'releases',
|
||||
@@ -102,10 +102,10 @@ class NntmuxResetDb extends Command
|
||||
],
|
||||
];
|
||||
|
||||
Elasticsearch::indices()->create($releases_index);
|
||||
\Elasticsearch::indices()->create($releases_index);
|
||||
|
||||
if (Elasticsearch::indices()->exists(['index' => 'predb'])) {
|
||||
Elasticsearch::indices()->delete(['index' => 'predb']);
|
||||
if (\Elasticsearch::indices()->exists(['index' => 'predb'])) {
|
||||
\Elasticsearch::indices()->delete(['index' => 'predb']);
|
||||
}
|
||||
$predb_index = [
|
||||
'index' => 'predb',
|
||||
@@ -118,7 +118,7 @@ class NntmuxResetDb extends Command
|
||||
],
|
||||
];
|
||||
|
||||
Elasticsearch::indices()->create($predb_index);
|
||||
\Elasticsearch::indices()->create($predb_index);
|
||||
|
||||
$this->info('All done! ElasticSearch indexes are deleted and recreated.');
|
||||
} else {
|
||||
|
||||
@@ -309,7 +309,7 @@ class Release extends Model
|
||||
'id' => $parameters['id'],
|
||||
];
|
||||
|
||||
Elasticsearch::index($data);
|
||||
\Elasticsearch::index($data);
|
||||
} else {
|
||||
(new SphinxSearch())->insertRelease($parameters);
|
||||
}
|
||||
@@ -378,7 +378,7 @@ class Release extends Model
|
||||
'id' => $ID,
|
||||
];
|
||||
|
||||
Elasticsearch::update($data);
|
||||
\Elasticsearch::update($data);
|
||||
} else {
|
||||
(new SphinxSearch())->updateRelease($ID);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ class ReleaseFile extends Model
|
||||
'id' => $id,
|
||||
];
|
||||
|
||||
Elasticsearch::update($data);
|
||||
\Elasticsearch::update($data);
|
||||
}
|
||||
} else {
|
||||
(new SphinxSearch())->updateRelease($id);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
require_once dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
|
||||
|
||||
if (Elasticsearch::indices()->exists(['index' => 'releases'])) {
|
||||
Elasticsearch::indices()->delete(['index' => 'releases']);
|
||||
if (\Elasticsearch::indices()->exists(['index' => 'releases'])) {
|
||||
\Elasticsearch::indices()->delete(['index' => 'releases']);
|
||||
}
|
||||
$releases_index = [
|
||||
'index' => 'releases',
|
||||
@@ -15,11 +15,11 @@ $releases_index = [
|
||||
],
|
||||
];
|
||||
|
||||
$response = Elasticsearch::indices()->create($releases_index);
|
||||
$response = \Elasticsearch::indices()->create($releases_index);
|
||||
|
||||
print_r($response);
|
||||
if (Elasticsearch::indices()->exists(['index' => 'predb'])) {
|
||||
Elasticsearch::indices()->delete(['index' => 'predb']);
|
||||
if (\Elasticsearch::indices()->exists(['index' => 'predb'])) {
|
||||
\Elasticsearch::indices()->delete(['index' => 'predb']);
|
||||
}
|
||||
$predb_index = [
|
||||
'index' => 'predb',
|
||||
@@ -31,7 +31,7 @@ $predb_index = [
|
||||
],
|
||||
];
|
||||
|
||||
$response = Elasticsearch::indices()->create($predb_index);
|
||||
$response = \Elasticsearch::indices()->create($predb_index);
|
||||
|
||||
print_r($response);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ function populate_indexes($table, $max)
|
||||
}
|
||||
}
|
||||
// Stop and send the bulk request
|
||||
$responses = Elasticsearch::bulk($data);
|
||||
$responses = \Elasticsearch::bulk($data);
|
||||
|
||||
// erase the old bulk request
|
||||
$data = ['body' => []];
|
||||
@@ -118,7 +118,7 @@ function populate_indexes($table, $max)
|
||||
|
||||
// Send the last batch if it exists
|
||||
if (! empty($data['body'])) {
|
||||
$responses = Elasticsearch::bulk($data);
|
||||
$responses = \Elasticsearch::bulk($data);
|
||||
}
|
||||
echo "\n[Done]\n";
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user