Update NameFixer to use fulltext search in matchPreDbFiles function

This commit is contained in:
DariusIII
2016-08-22 10:18:54 +02:00
parent cb32830aa5
commit 06dc02e10f
3 changed files with 13 additions and 6 deletions
+1
View File
@@ -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
View File
@@ -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)
)
);
}
-3
View File
@@ -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);