[pLog-svn] r2516 - plog/branches/plog-1.0.2/class/dao
mark at devel.plogworld.net
mark at devel.plogworld.net
Thu Sep 22 06:06:24 GMT 2005
Author: mark
Date: 2005-09-22 06:06:22 +0000 (Thu, 22 Sep 2005)
New Revision: 2516
Modified:
plog/branches/plog-1.0.2/class/dao/searchengine.class.php
Log:
Fix the search engine bug according to http://bugs.plogworld.net/view.php?id=653
Modified: plog/branches/plog-1.0.2/class/dao/searchengine.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/searchengine.class.php 2005-09-22 03:23:42 UTC (rev 2515)
+++ plog/branches/plog-1.0.2/class/dao/searchengine.class.php 2005-09-22 06:06:22 UTC (rev 2516)
@@ -167,8 +167,12 @@
a.properties AS properties, t.normalized_text AS normalized_text,
t.normalized_topic AS normalized_topic, a.status AS status, a.slug AS slug,
1 AS relevance
- FROM {$prefix}articles a, {$prefix}articles_text t
- WHERE {$where_string} AND a.id = t.article_id AND a.status = $status";
+ FROM {$prefix}articles a
+ LEFT JOIN {$prefix}articles_text t ON a.id=t.article_id
+ LEFT JOIN {$prefix}blogs b ON a.blog_id=b.id
+ WHERE {$where_string} AND a.status = $status
+ AND b.show_in_summary=1 AND b.status=".BLOG_STATUS_ACTIVE;
+
if( $blogId > 0 )
$searchQuery .= " AND a.blog_id = '".Db::qstr($blogId)."'";
if( $userId > 0 )
@@ -258,10 +262,14 @@
a.properties AS properties, t.normalized_text AS normalized_text,
t.normalized_topic AS normalized_topic, a.status AS status, a.slug AS slug,
1 AS relevance
- FROM {$prefix}custom_fields_values v, {$prefix}articles a, {$prefix}articles_text t
- WHERE (v.field_value LIKE '%{$query}%') AND v.article_id = a.id AND a.status = $status
- AND t.article_id = a.id";
- if( $blogId > 0 )
+ FROM {$prefix}custom_fields_values v
+ LEFT JOIN {$prefix}articles a ON v.article_id = a.id
+ LEFT JOIN {$prefix}articles_text t ON a.id=t.article_id
+ LEFT JOIN {$prefix}blogs b ON a.blog_id=b.id
+ WHERE (v.field_value LIKE '%{$query}%') AND a.status = $status
+ AND b.show_in_summary=1 AND b.status=".BLOG_STATUS_ACTIVE;
+
+ if( $blogId > 0 )
$searchQuery .= " AND a.blog_id = '".Db::qstr($blogId)."' ";
if( $userId > 0 )
$searchQuery .= " AND a.user_id = '".Db::qstr($userId)."' ";
@@ -275,7 +283,7 @@
//print "<hr />";
return $this->_getQueryResults( $searchQuery, SEARCH_RESULT_CUSTOM_FIELD );
}
-
+
/**
* Returns an array of SearchResult objects containing information about the search, such as the
* relevance (not very relevant, though :)), and the ArticleObject
@@ -312,9 +320,12 @@
a.properties AS properties, t.normalized_text AS normalized_text,
t.normalized_topic AS normalized_topic, a.status AS status, a.slug AS slug,
1 AS relevance
- FROM {$prefix}articles_comments c, {$prefix}articles a, {$prefix}articles_text t
- WHERE {$where_string} AND c.article_id = a.id AND a.status = $status AND c.status = 0
- AND t.article_id = a.id";
+ FROM {$prefix}articles_comments c
+ LEFT JOIN {$prefix}articles a ON c.article_id = a.id
+ LEFT JOIN {$prefix}articles_text t ON a.id=t.article_id
+ LEFT JOIN {$prefix}blogs b ON a.blog_id=b.id
+ WHERE {$where_string} AND a.status = $status AND c.status = 0
+ AND b.show_in_summary=1 AND b.status=".BLOG_STATUS_ACTIVE;
if( $blogId > 0 )
$searchQuery .=" AND a.blog_id = '".Db::qstr($blogId)."' ";
if( $userId > 0 )
More information about the pLog-svn
mailing list