Merge branch 'dev-sphinx' of https://github.com/NNTmux/newznab-tmux into dev-sphinx

This commit is contained in:
DariusIII
2018-02-08 12:35:53 +01:00
7 changed files with 9 additions and 13 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
<?php
return [
'host' => '127.0.0.1',
'port' => 9306,
'index' => 'releases_rt'
'index' => 'releases_rt',
];
+2 -2
View File
@@ -3,8 +3,8 @@
require_once dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
use App\Models\Release;
use Illuminate\Support\Facades\DB;
use nntmux\SphinxSearch;
use Illuminate\Support\Facades\DB;
if (! isset($argv[1]) || $argv[1] !== 'releases_rt') {
exit(
@@ -47,7 +47,7 @@ function populate_rt($table, $max)
$string = sprintf('REPLACE INTO %s %s VALUES ', $table, $rtvalues);
$lastId = $minId - 1;
echo "[Starting to populate sphinx RT index $table with $total releases.]" . PHP_EOL;
echo "[Starting to populate sphinx RT index $table with $total releases.]".PHP_EOL;
for ($i = $minId; $i <= ($total + $max + $minId); $i += $max) {
$rows = DB::select(sprintf($query, $lastId, $max));
DB::commit();
+2 -3
View File
@@ -1114,9 +1114,8 @@ class NameFixer
$join = '';
if (\strlen($preTitle) >= 15 && preg_match(self::PREDB_REGEX, $preTitle)) {
$titlematch = SphinxSearch::escapeString($preTitle);
$join .= sprintf(
$titlematch = SphinxSearch::escapeString($preTitle);
$join .= sprintf(
'INNER JOIN releases_se rse ON rse.id = r.id
WHERE rse.query = "@(name,searchname,filename) %s;mode=extended"',
$titlematch
+1 -3
View File
@@ -738,9 +738,7 @@ class ReleaseRemover
if ($this->crapTime === '') {
$regexMatch = $this->extractSrchFromRegx($dbRegex);
if ($regexMatch !== '') {
$ftMatch = sprintf('rse.query = "@(name,searchname) %s;limit=1000000;maxmatches=1000000;mode=any" AND', str_replace('|', ' ', str_replace('"', '', $regexMatch)));
$ftMatch = sprintf('rse.query = "@(name,searchname) %s;limit=1000000;maxmatches=1000000;mode=any" AND', str_replace('|', ' ', str_replace('"', '', $regexMatch)));
}
}
+1
View File
@@ -61,6 +61,7 @@ class ReleaseSearch
if ($forceLike) {
return $this->likeSQL();
}
return $this->sphinxSQL();
}
+1 -1
View File
@@ -3,9 +3,9 @@
namespace nntmux;
use App\Models\Release;
use Foolz\SphinxQL\Drivers\Pdo\Connection;
use Foolz\SphinxQL\Helper;
use Foolz\SphinxQL\SphinxQL;
use Foolz\SphinxQL\Drivers\Pdo\Connection;
class SphinxSearch
{
-3
View File
@@ -4,7 +4,6 @@ use App\Models\User;
use nntmux\Releases;
use App\Models\Group;
use App\Models\Category;
use nntmux\ReleaseSearch;
if (! User::isLoggedIn()) {
$page->show403();
@@ -159,8 +158,6 @@ if (isset($_REQUEST['searchadvr']) && ! isset($_REQUEST['id']) && ! isset($_REQU
);
}
$search_description =
'Sphinx Search Rules:<br />
The search is case insensitive.<br />