summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHash9 <hash9@users.sourceforge.net>2007-01-16 22:41:16 +0000
committerHash9 <hash9@users.sourceforge.net>2007-01-16 22:41:16 +0000
commit89995c99042c6c499142d326f01b702b0f7b7586 (patch)
treebe8d717d08e02a5476371da3d5fb1ef58e535a8a
parent809325ac82464fd3c4193c9c24f8ed0079239ccb (diff)
downloadsearch-89995c99042c6c499142d326f01b702b0f7b7586.tar.gz
search-89995c99042c6c499142d326f01b702b0f7b7586.tar.bz2
search-89995c99042c6c499142d326f01b702b0f7b7586.zip
fix subquery so they only return one result and don't use a select-limit clause
-rw-r--r--search_lib.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/search_lib.php b/search_lib.php
index 66dbcb0..ae3d5ae 100644
--- a/search_lib.php
+++ b/search_lib.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_search/search_lib.php,v 1.29 2006/12/27 07:30:07 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_search/search_lib.php,v 1.30 2007/01/16 22:41:16 hash9 Exp $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -8,7 +8,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: search_lib.php,v 1.29 2006/12/27 07:30:07 squareing Exp $
+ * $Id: search_lib.php,v 1.30 2007/01/16 22:41:16 hash9 Exp $
* @author Luis Argerich (lrargerich@yahoo.com)
* @package search
*/
@@ -187,7 +187,7 @@ class SearchLib extends BitBase {
lc.`last_modified`,
lc.`data`,
COALESCE((
- SELECT FIRST 1 SUM(i_count)
+ SELECT SUM(i_count)
FROM `" . BIT_DB_PREFIX . "search_index` si
WHERE si.`content_id`=lc.`content_id` AND si.`searchword` IN (" . $qPlaceHolders1 . ")
),0) AS relivency
@@ -199,10 +199,9 @@ class SearchLib extends BitBase {
SELECT SUM(i_count)
FROM `" . BIT_DB_PREFIX . "search_index` si
WHERE si.`content_id`=lc.`content_id`
+ AND si.`searchword` IN (" . $qPlaceHolders1 . ")
GROUP BY
- si.`content_id`,
- si.`searchword`
- HAVING si.`searchword` IN (" . $qPlaceHolders1 . ")
+ si.`content_id`
)>0 $whereSql
ORDER BY 9 DESC, 5 DESC
";
@@ -215,10 +214,9 @@ class SearchLib extends BitBase {
SELECT SUM(i_count)
FROM `" . BIT_DB_PREFIX . "search_index` si
WHERE si.`content_id`=lc.`content_id`
+ AND si.`searchword` IN (" . $qPlaceHolders1 . ")
GROUP BY
- si.`content_id`,
- si.`searchword`
- HAVING si.`searchword` IN (" . $qPlaceHolders1 . ")
+ si.`content_id`
)>0 $whereSql";
$result = $this->mDb->query( $query, array_merge( $words ,$bindVars), $max_records, $offset );
$cant = $this->mDb->getOne( $querycant, $bindVars );