summaryrefslogtreecommitdiff
path: root/modules/search.module
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2005-11-21 15:55:17 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2005-11-21 15:55:17 +0000
commit17205b6e6201af0e4dea338009be794fddbc1712 (patch)
treeb7ee9811e2e397a75624532de9d2f914fdfbc852 /modules/search.module
parent4febf6443b74416b26374150808158db95f51083 (diff)
downloadbrdo-17205b6e6201af0e4dea338009be794fddbc1712.tar.gz
brdo-17205b6e6201af0e4dea338009be794fddbc1712.tar.bz2
#36352: Don't prefix temporary table names after all.
#36658: Make search query pgsql compatible.
Diffstat (limited to 'modules/search.module')
-rw-r--r--modules/search.module10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/search.module b/modules/search.module
index f8e57e408..d1c5f735e 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -772,10 +772,10 @@ function do_search($keywords, $type, $join1 = '', $where1 = '1', $arguments1 = a
// 'matches' is used to reject those items that cannot possibly match the query.
$conditions = $where1 .' AND ('. $query[2] .") AND i.type = '%s'";
$arguments = array_merge($arguments1, $query[3], array($type, $query[4]));
- $result = db_query_temporary("SELECT i.type, i.sid, SUM(i.score * t.count) AS relevance, COUNT(*) AS matches FROM {search_index} i INNER JOIN {search_total} t ON i.word = t.word $join1 WHERE $conditions GROUP BY i.type, i.sid HAVING matches >= %d", $arguments, 'temp_search_sids');
+ $result = db_query_temporary("SELECT i.type, i.sid, SUM(i.score * t.count) AS relevance, COUNT(*) AS matches FROM {search_index} i INNER JOIN {search_total} t ON i.word = t.word $join1 WHERE $conditions GROUP BY i.type, i.sid HAVING COUNT(*) >= %d", $arguments, 'temp_search_sids');
// Calculate maximum relevance, to normalize it
- $normalize = db_result(db_query('SELECT MAX(relevance) FROM {temp_search_sids}'));
+ $normalize = db_result(db_query('SELECT MAX(relevance) FROM temp_search_sids'));
if (!$normalize) {
return array();
}
@@ -784,14 +784,14 @@ function do_search($keywords, $type, $join1 = '', $where1 = '1', $arguments1 = a
// Second pass: only keep items that match the complicated keywords conditions (phrase search, negative keywords, ...)
$conditions = '('. $query[0] .')';
$arguments = array_merge($arguments2, $query[1]);
- $result = db_query_temporary("SELECT i.type, i.sid, $select2 FROM {temp_search_sids} i INNER JOIN {search_dataset} d ON i.sid = d.sid AND i.type = d.type $join2 WHERE $conditions ORDER BY score DESC", $arguments, 'temp_search_results');
- if (($count = db_result(db_query('SELECT COUNT(*) FROM {temp_search_results}'))) == 0) {
+ $result = db_query_temporary("SELECT i.type, i.sid, $select2 FROM temp_search_sids i INNER JOIN {search_dataset} d ON i.sid = d.sid AND i.type = d.type $join2 WHERE $conditions ORDER BY score DESC", $arguments, 'temp_search_results');
+ if (($count = db_result(db_query('SELECT COUNT(*) FROM temp_search_results'))) == 0) {
return array();
}
$count_query = "SELECT $count";
// Do actual search query
- $result = pager_query("SELECT * FROM {temp_search_results}", 10, 0, $count_query, $arguments);
+ $result = pager_query("SELECT * FROM temp_search_results", 10, 0, $count_query, $arguments);
$results = array();
while ($item = db_fetch_object($result)) {
$results[] = $item->sid;