summaryrefslogtreecommitdiff
path: root/app/Models/EntryDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-16 17:45:57 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-16 17:45:57 +0100
commit8abeeaf65e79a464aae6d40f8868ecd29889df4c (patch)
tree981498433ed8ce68b9754611279c12be5b8b1815 /app/Models/EntryDAO.php
parent847de9b3292ad854b281d7e12cc36ac93e745139 (diff)
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
Diffstat (limited to 'app/Models/EntryDAO.php')
-rw-r--r--app/Models/EntryDAO.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index 5a34573db..c4eb0a84a 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -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 '