From 92dc5c70fc8f0a350242371aabc736d2dd02af43 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Fri, 9 Feb 2018 09:37:22 +0100 Subject: [PATCH] Update SphinxSearch class --- Changelog | 1 + nntmux/SphinxSearch.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Changelog b/Changelog index 8bb6f6c949..f2af0c7c4e 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-02-09 DariusIII + * Chg: Update SphinxSearch class * Chg: Add patch to remove now unused triggers * Fix: Fix migrations, add patch to remove old and insert new fulltext indexes * Chg: Remove release_search_data table migration as that table is not used anymore. Remove db conversion script. diff --git a/nntmux/SphinxSearch.php b/nntmux/SphinxSearch.php index 3106fcbed8..a58aabce79 100755 --- a/nntmux/SphinxSearch.php +++ b/nntmux/SphinxSearch.php @@ -22,7 +22,7 @@ class SphinxSearch /** * @var \Illuminate\Config\Repository|mixed */ - protected $index; + protected $config; /** * Establish connection to SphinxQL. @@ -32,9 +32,9 @@ class SphinxSearch public function __construct() { $this->connection = new Connection(); - $this->connection->setParams(['host' => config('sphinxsearch.host'), 'port' => config('sphinxsearch.port')]); + $this->config = config('sphinxsearch'); + $this->connection->setParams(['host' => $this->config['host'], 'port' => $this->config['port']]); $this->sphinxQL = SphinxQL::create($this->connection); - $this->index = config('sphinxsearch.index'); } /** @@ -46,7 +46,7 @@ public function insertRelease($parameters): void if ($this->sphinxQL !== null && $parameters['id']) { $this->sphinxQL ->replace() - ->into($this->index) + ->into($this->config['index']) ->set(['id' => $parameters['id'], 'name' => $parameters['name'], 'searchname' => $parameters['searchname'], 'fromname' => $parameters['fromname'], 'filename' => empty($parameters['filename']) ? "''" : $parameters['filename']]) ->execute(); } @@ -65,7 +65,7 @@ public function deleteRelease($identifiers): void } } if ($identifiers['i'] !== false) { - $this->sphinxQL->delete()->from([$this->index])->where('id', '=', $identifiers['i']); + $this->sphinxQL->delete()->from([$this->config['index']])->where('id', '=', $identifiers['i']); } } @@ -110,7 +110,7 @@ public function updateRelease($releaseID): void */ public function truncateRTIndex(): void { - Helper::create($this->connection)->truncateRtIndex($this->index); + Helper::create($this->connection)->truncateRtIndex($this->config['index']); } /** @@ -118,7 +118,7 @@ public function truncateRTIndex(): void */ public function optimizeRTIndex(): void { - Helper::create($this->connection)->flushRtIndex($this->index); - Helper::create($this->connection)->optimizeIndex($this->index); + Helper::create($this->connection)->flushRtIndex($this->config['index']); + Helper::create($this->connection)->optimizeIndex($this->config['index']); } }