mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-01 10:48:53 +00:00
Update NameFixer to use fulltext search in matchPreDbFiles function
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2016-08-22 DariusIII
|
||||
* Chg: Update NameFixer to use FULLTEXT search in matchPreDbFiles function
|
||||
* Chg: Add FULLTEXT index to predb.filename
|
||||
2016-08-21 DariusIII
|
||||
* Chg: Remove match_prefiles from tmux, should be ran manualy
|
||||
|
||||
+12
-3
@@ -947,16 +947,25 @@ class NameFixer
|
||||
$matching = 0;
|
||||
$this->_fileName = $this->_cleanMatchFiles($release['filename']);
|
||||
$pre = false;
|
||||
$preMatch = preg_match('/(\d{2}\.\d{2}\.\d{2})+[\w-.]+[\w]$/i', $this->_fileName, $match);
|
||||
if($preMatch) {
|
||||
$result = $this->pdo->queryOneRow(sprintf("SELECT filename AS filename FROM predb WHERE MATCH(filename) AGAINST ('$match[0]' IN BOOLEAN MODE)"));
|
||||
$preFTmatch = preg_match('/(\d{2}\.\d{2}\.\d{2})+[\w-.]+[\w]$/i', $result['filename'], $match1);
|
||||
if($preFTmatch) {
|
||||
if ($match[0] == $match1[0]) {
|
||||
$this->_fileName = $result['filename'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->_fileName !== '') {
|
||||
$pre = $this->pdo->queryOneRow(
|
||||
sprintf('
|
||||
SELECT id AS predb_id, title, source
|
||||
FROM predb
|
||||
WHERE filename = %s %s
|
||||
WHERE filename = %s
|
||||
OR title = %1$s',
|
||||
$this->pdo->escapeString($this->_fileName),
|
||||
preg_match('/(\d{2}\.\d{2}\.\d{2})+[\w-.]+[\w]$/i', $this->_fileName, $match) ? 'OR filename ' . $this->pdo->likeString($match[0], true, false) : ''
|
||||
$this->pdo->escapeString($this->_fileName)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# Add FULLTEXT index on predb.filename. This patch might take some time to complete.
|
||||
|
||||
ALTER TABLE predb ADD FULLTEXT INDEX ft_predb_filename (filename);
|
||||
Reference in New Issue
Block a user