mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-22 03:04:31 -04:00
SQL : correction recherche
Oups, mon précédent changement SQL avait cassé la recherche. Patch rapide en attendant une ré-optimisation en particulier pour le cas de recherche sur plusieurs mots
This commit is contained in:
1 parent
847de9b329
commit
8abeeaf65e
1 file changed
+4
-4
@@ -311,14 +311,14 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
|
||||
}
|
||||
$terms = array_unique(explode(' ', trim($filter)));
|
||||
sort($terms); //Put #tags first
|
||||
$having = '';
|
||||
$search = '';
|
||||
foreach ($terms as $word) {
|
||||
if (!empty($word)) {
|
||||
if ($word[0] === '#' && isset($word[1])) {
|
||||
$having .= 'AND e1.tags LIKE ? ';
|
||||
$search .= 'AND e1.tags LIKE ? ';
|
||||
$values[] = '%' . $word .'%';
|
||||
} elseif (!empty($word)) {
|
||||
$having .= 'AND (e1.title LIKE ? OR content LIKE ?) ';
|
||||
$search .= 'AND (e1.title LIKE ? OR UNCOMPRESS(e1.content_bin) LIKE ?) ';
|
||||
$values[] = '%' . $word .'%';
|
||||
$values[] = '%' . $word .'%';
|
||||
}
|
||||
@@ -330,7 +330,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
|
||||
. 'INNER JOIN (SELECT e1.id FROM `' . $this->prefix . 'entry` e1 '
|
||||
. ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e1.id_feed = f.id ' : '')
|
||||
. 'WHERE ' . $where
|
||||
. (empty($having) ? '' : 'HAVING' . substr($having, 3))
|
||||
. $search
|
||||
. 'ORDER BY e1.id ' . $order
|
||||
. ($limit > 0 ? ' LIMIT ' . $limit : '') //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/
|
||||
. ') e2 ON e2.id = e.id '
|
||||
|
||||
Reference in new issue
Block a user