From 21062d878cc66d656d4a262399f0ccfa62ec7b5c Mon Sep 17 00:00:00 2001 From: DariusIII Date: Tue, 15 Jan 2019 09:22:04 +0100 Subject: [PATCH] Fix insertion of data into predb_rt index from IRCScraper --- Blacklight/IRCScraper.php | 5 ++++- Blacklight/SphinxSearch.php | 14 ++++---------- Changelog | 2 ++ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Blacklight/IRCScraper.php b/Blacklight/IRCScraper.php index c9be43b60..b42211c3b 100755 --- a/Blacklight/IRCScraper.php +++ b/Blacklight/IRCScraper.php @@ -323,6 +323,7 @@ class IRCScraper extends IRCClient 'id' => DB::connection()->getPdo()->lastInsertId(), 'title' => $this->_curPre['title'], 'filename' => $this->_curPre['filename'], + 'source' => $this->_curPre['source'], ]; (new SphinxSearch())->insertPredb($parameters); @@ -333,7 +334,8 @@ class IRCScraper extends IRCClient /** * Updates PRE data in the DB. * - * @throws \RuntimeException + * + * @throws \Exception */ protected function _updatePre() { @@ -371,6 +373,7 @@ class IRCScraper extends IRCClient 'id' => DB::connection()->getPdo()->lastInsertId(), 'title' => $this->_curPre['title'], 'filename' => $this->_curPre['filename'], + 'source' => $this->_curPre['source'], ]; (new SphinxSearch())->updatePreDb($parameters); diff --git a/Blacklight/SphinxSearch.php b/Blacklight/SphinxSearch.php index 963e64e57..8407dbf06 100755 --- a/Blacklight/SphinxSearch.php +++ b/Blacklight/SphinxSearch.php @@ -139,19 +139,13 @@ class SphinxSearch /** * Update Sphinx Predb index for given predb_id. * - * @param int $title + * @param array $parameters * @throws \Exception */ - public function updatePreDb($title): void + public function updatePreDb($parameters): void { - $new = Predb::query() - ->where('title', $title) - ->select(['id', 'title', 'filename', 'source']) - ->groupBy('id') - ->first(); - - if ($new !== null) { - $this->insertPredb($new); + if (! empty($parameters)) { + $this->insertPredb($parameters); } } diff --git a/Changelog b/Changelog index 4727d8d11..f3059a5d7 100755 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +2019-01-15 DariusIII + * Fix: Fix insertion of data into predb_rt index from IRCScraper 2019-01-14 DariusIII * Chg: Update opis/closure (3.1.4 => 3.1.5) * Chg: Update dariusiii/rarinfo to version 2.7.2