[Fusionforge-commits] r14114 - in branches/Branch_5_1: . src/common/search

Roland Mas lolando at fusionforge.org
Fri Aug 12 17:30:42 CEST 2011


Author: lolando
Date: 2011-08-12 17:30:42 +0200 (Fri, 12 Aug 2011)
New Revision: 14114

Modified:
   branches/Branch_5_1/
   branches/Branch_5_1/src/common/search/ArtifactSearchQuery.class.php
   branches/Branch_5_1/src/common/search/DocsSearchQuery.class.php
   branches/Branch_5_1/src/common/search/ExportProjectSearchQuery.class.php
   branches/Branch_5_1/src/common/search/ForumSearchQuery.class.php
   branches/Branch_5_1/src/common/search/ForumsSearchQuery.class.php
   branches/Branch_5_1/src/common/search/FrsSearchQuery.class.php
   branches/Branch_5_1/src/common/search/NewsSearchQuery.class.php
   branches/Branch_5_1/src/common/search/PeopleSearchQuery.class.php
   branches/Branch_5_1/src/common/search/ProjectSearchQuery.class.php
   branches/Branch_5_1/src/common/search/SkillSearchQuery.class.php
   branches/Branch_5_1/src/common/search/TasksSearchQuery.class.php
   branches/Branch_5_1/src/common/search/TrackersSearchQuery.class.php
Log:
Bugfixes everywhene in search-related SQL queries

Modified: branches/Branch_5_1/src/common/search/ArtifactSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/ArtifactSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/ArtifactSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -72,10 +72,10 @@
 
 			if (count($words)) {
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT a.group_artifact_id, a.artifact_id, headline(summary, $1) AS summary, ',
+							 'SELECT a.group_artifact_id, a.artifact_id, ts_headline(summary, $1) AS summary, ',
 							 array ($this->getFormattedWords())) ;
 				$qpa = db_construct_qpa ($qpa,
-							 'a.open_date, users.realname, rank FROM (SELECT a.artifact_id, SUM (RANK(ai.vectors, q) + RANK(ami.vectors, q)) AS rank FROM artifact a LEFT OUTER JOIN artifact_message am USING (artifact_id)') ;
+							 'a.open_date, users.realname, rank FROM (SELECT a.artifact_id, SUM (ts_rank(ai.vectors, q) + ts_rank(ami.vectors, q)) AS rank FROM artifact a LEFT OUTER JOIN artifact_message am USING (artifact_id)') ;
 
 				$qpa = db_construct_qpa ($qpa,
 							 ', artifact_idx ai, artifact_message_idx ami, to_tsquery($1) q',
@@ -90,7 +90,7 @@
 					$qpa = db_construct_qpa ($qpa,
 								 $this->getOperator()) ;
 					$qpa = db_construct_qpa ($qpa,
-								 '(') ;
+								 '((') ;
 					$qpa = $this->addMatchCondition($qpa, 'a.details');
 					$qpa = db_construct_qpa ($qpa,
 								 ') OR (') ;
@@ -99,7 +99,7 @@
 								 ') OR (') ;
 					$qpa = $this->addMatchCondition($qpa, 'am.body');
 					$qpa = db_construct_qpa ($qpa,
-								 ')') ;
+								 '))') ;
 				}
 				$qpa = db_construct_qpa ($qpa,
 							 ') GROUP BY a.artifact_id) x, artifact a, users WHERE a.artifact_id=x.artifact_id AND users.user_id=a.submitted_by ORDER BY group_artifact_id ASC, rank DESC, a.artifact_id ASC') ;
@@ -113,9 +113,7 @@
 
 				if (count($this->phrases)) {
 					$qpa = db_construct_qpa ($qpa,
-								 ' AND (') ;
-					$qpa = db_construct_qpa ($qpa,
-								 '(') ;
+								 ' AND ((') ;
 					$qpa = $this->addMatchCondition($qpa, 'a.details');
 					$qpa = db_construct_qpa ($qpa,
 								 ') OR (') ;

Modified: branches/Branch_5_1/src/common/search/DocsSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/DocsSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/DocsSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -104,7 +104,7 @@
 		$qpa = db_construct_qpa () ;
 		if(count($this->words)) {
 			$qpa = db_construct_qpa ($qpa,
-						 'SELECT doc_data.docid, doc_data.filename, headline(doc_data.title, q) AS title, headline(doc_data.description, q) AS description doc_groups.groupname FROM doc_data, doc_groups, doc_data_idx, to_tsquery($1) q',
+						 'SELECT doc_data.docid, doc_data.filename, ts_headline(doc_data.title, q) AS title, ts_headline(doc_data.description, q) AS description doc_groups.groupname FROM doc_data, doc_groups, doc_data_idx, to_tsquery($1) q',
 						 array (implode (' ', $words))) ;
 			$qpa = db_construct_qpa ($qpa,
 						 ' WHERE doc_data.doc_group = doc_groups.doc_group AND doc_data.docid = doc_data_idx.docid AND (vectors @@ q') ;
@@ -136,7 +136,7 @@
 							 ' AND doc_data.stateid = 1') ;
 			}
 			$qpa = db_construct_qpa ($qpa,
-						 ' ORDER BY rank(vectors, q) DESC, groupname ASC') ;
+						 ' ORDER BY ts_rank(vectors, q) DESC, groupname ASC') ;
 		} else {
 			$qpa = db_construct_qpa ($qpa,
 						 'SELECT doc_data.docid, title, filename, description doc_groups.groupname FROM doc_data, doc_groups') ;
@@ -146,13 +146,13 @@
 				$qpa = db_construct_qpa ($qpa,
 							 $this->getOperator()) ;
 				$qpa = db_construct_qpa ($qpa,
-							 '(') ;
+							 '((') ;
 				$qpa = $this->addMatchCondition($qpa, 'title');
 				$qpa = db_construct_qpa ($qpa,
 							 ') OR (') ;
 				$qpa = $this->addMatchCondition($qpa, 'description');
 				$qpa = db_construct_qpa ($qpa,
-							 ')') ;
+							 '))') ;
 			}
 			$qpa = db_construct_qpa ($qpa,
 						 ') AND doc_data.group_id = $1',

Modified: branches/Branch_5_1/src/common/search/ExportProjectSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/ExportProjectSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/ExportProjectSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -48,7 +48,7 @@
 			$words = $this->getFormattedWords();
 			if(count($this->words)) {
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT headline(unix_group_name, q) as unix_group_name, headline(short_description, q) as short_description, type_id, groups.group_id, license, register_time FROM groups, groups_idx, to_tsquery($1) q ',
+							 'SELECT ts_headline(unix_group_name, q) as unix_group_name, ts_headline(short_description, q) as short_description, type_id, groups.group_id, license, register_time FROM groups, groups_idx, to_tsquery($1) q ',
 							 array (implode (' ', $words))) ;
 				$qpa = db_construct_qpa ($qpa,
 							 'WHERE status IN ($1, $2) AND short_description <> $3 AND groups.group_id = groups_idx.group_id',
@@ -73,7 +73,7 @@
 								 ')') ;
 				}
 				$qpa = db_construct_qpa ($qpa,
-							 ') ORDER BY rank(vectors, q) DESC, group_name ASC') ;
+							 ') ORDER BY ts_rank(vectors, q) DESC, group_name ASC') ;
 			} else {
 				$qpa = db_construct_qpa ($qpa,
 							 'SELECT unix_group_name, short_description, type_id, groups.group_id, license, register_time FROM groups ') ;
@@ -84,9 +84,7 @@
 								'')) ;
 				if (count($this->phrases)) {
 					$qpa = db_construct_qpa ($qpa,
-								 ' AND (' ) ;
-					$qpa = db_construct_qpa ($qpa,
-								 '(') ;
+								 ' AND ((' ) ;
 					$qpa = $this->addMatchCondition($qpa, 'group_name');
 					$qpa = db_construct_qpa ($qpa,
 								 ') OR (') ;

Modified: branches/Branch_5_1/src/common/search/ForumSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/ForumSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/ForumSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -71,7 +71,7 @@
 
 			if(count($this->words)) {
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT forum.msg_id, headline(forum.subject, q) AS subject, forum.post_date, users.realname FROM forum, users, to_tsquery($1) AS q, forum_idx as fi WHERE forum.group_forum_id = $2 AND forum.posted_by = users.user_id AND fi.msg_id = forum.msg_id AND vectors @@ q ',
+							 'SELECT forum.msg_id, ts_headline(forum.subject, q) AS subject, forum.post_date, users.realname FROM forum, users, to_tsquery($1) AS q, forum_idx as fi WHERE forum.group_forum_id = $2 AND forum.posted_by = users.user_id AND fi.msg_id = forum.msg_id AND vectors @@ q ',
 							 array ($words,
 								$this->forumId)) ;
 				$phraseOp = $this->getOperator();
@@ -93,7 +93,7 @@
 			}
 			if(count($this->words)) {
 				$qpa = db_construct_qpa ($qpa,
-							 'ORDER BY rank(vectors, q) DESC') ;
+							 'ORDER BY ts_rank(vectors, q) DESC') ;
 			} else {
 				$qpa = db_construct_qpa ($qpa,
 							 'ORDER BY post_date DESC') ;

Modified: branches/Branch_5_1/src/common/search/ForumsSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/ForumsSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/ForumsSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -80,7 +80,7 @@
 			}
 
 			$qpa = db_construct_qpa ($qpa,
-						 'SELECT forum.msg_id, headline(forum.subject, q) AS subject, forum.post_date, users.realname, forum_group_list.forum_name FROM forum, users, forum_group_list, forum_idx, to_tsquery($1) as q ',
+						 'SELECT forum.msg_id, ts_headline(forum.subject, q) AS subject, forum.post_date, users.realname, forum_group_list.forum_name FROM forum, users, forum_group_list, forum_idx, to_tsquery($1) as q ',
 						 array ($this->getFormattedWords())) ;
 			$qpa = db_construct_qpa ($qpa,
 						 'WHERE users.user_id = forum.posted_by AND vectors @@ q AND forum.msg_id = forum_idx.msg_id AND forum_group_list.group_forum_id = forum.group_forum_id AND forum_group_list.is_public <> 9 AND forum.group_forum_id IN (SELECT group_forum_id FROM forum_group_list WHERE group_id = $1) ',
@@ -95,7 +95,7 @@
 							 'AND forum_group_list.is_public = 1 ') ;
 			}
 			$qpa = db_construct_qpa ($qpa,
-						 'ORDER BY forum_group_list.forum_name ASC, forum.msg_id ASC, rank(vectors, q) DESC') ;
+						 'ORDER BY forum_group_list.forum_name ASC, forum.msg_id ASC, ts_rank(vectors, q) DESC') ;
 		} else {
 			$qpa = db_construct_qpa ($qpa,
 						 'SELECT forum.msg_id, forum.subject, forum.post_date, users.realname, forum_group_list.forum_name FROM forum, users, forum_group_list WHERE users.user_id = forum.posted_by AND forum_group_list.group_forum_id = forum.group_forum_id AND forum_group_list.is_public <> 9 AND forum.group_forum_id IN (SELECT group_forum_id FROM forum_group_list WHERE group_id = $1) ',

Modified: branches/Branch_5_1/src/common/search/FrsSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/FrsSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/FrsSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -72,7 +72,7 @@
 			if(count($this->words)) {
 				$qpa = db_construct_qpa () ;
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT headline(frs_package.name, q) AS package_name, headline(frs_release.name, q) as release_name, frs_release.release_date, frs_release.release_id, users.realname FROM frs_file, frs_release, users, frs_package, to_tsquery($1) AS q, frs_release_idx r, frs_file_idx f WHERE frs_release.released_by = users.user_id AND r.release_id = frs_release.release_id AND f.file_id = frs_file.file_id AND frs_package.package_id = frs_release.package_id AND frs_file.release_id=frs_release.release_id AND frs_package.group_id=$2 ',
+							 'SELECT ts_headline(frs_package.name, q) AS package_name, ts_headline(frs_release.name, q) as release_name, frs_release.release_date, frs_release.release_id, users.realname FROM frs_file, frs_release, users, frs_package, to_tsquery($1) AS q, frs_release_idx r, frs_file_idx f WHERE frs_release.released_by = users.user_id AND r.release_id = frs_release.release_id AND f.file_id = frs_file.file_id AND frs_package.package_id = frs_release.package_id AND frs_file.release_id=frs_release.release_id AND frs_package.group_id=$2 ',
 							 array ($this->getFormattedWords(),
 								 $this->groupId)) ;
 			} else {

Modified: branches/Branch_5_1/src/common/search/NewsSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/NewsSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/NewsSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -62,12 +62,12 @@
 			if (count ($this->words)) {
 				$words = $this->getFormattedWords();
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT headline(news_bytes.summary, q) as summary, news_bytes.post_date, news_bytes.forum_id, users.realname FROM news_bytes, users, to_tsquery($1) AS q, news_bytes_idx WHERE (news_bytes.group_id=$2 AND news_bytes.is_approved <> 4 AND news_bytes_idx.id = news_bytes.id AND news_bytes.submitted_by=users.user_id) AND (vectors @@ q ',
+							 'SELECT ts_headline(news_bytes.summary, q) as summary, news_bytes.post_date, news_bytes.forum_id, users.realname FROM news_bytes, users, to_tsquery($1) AS q, news_bytes_idx WHERE (news_bytes.group_id=$2 AND news_bytes.is_approved <> 4 AND news_bytes_idx.id = news_bytes.id AND news_bytes.submitted_by=users.user_id) AND (vectors @@ q ',
 							 array ($words,
 								$group_id)) ;
 			} else {
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT summary, news_bytes.post_date, news_bytes.forum_id, users.realname FROM news_bytes, users WHERE (news_bytes.group_id=$1 AND news_bytes.is_approved <> 4 AND news_bytes.submitted_by=users.user_id) AND (',
+							 'SELECT summary, news_bytes.post_date, news_bytes.forum_id, users.realname FROM news_bytes, users WHERE (news_bytes.group_id=$1 AND news_bytes.is_approved <> 4 AND news_bytes.submitted_by=users.user_id) ',
 							 array ($group_id)) ;
 			}
 			if (count ($this->phrases)) {
@@ -76,17 +76,17 @@
 								 $this->getOperator()) ;
 				}
 				$qpa = db_construct_qpa ($qpa,
-							 ' (') ;
+							 ' ((') ;
 				$qpa = $this->addMatchCondition ($qpa, 'summary') ;
 				$qpa = db_construct_qpa ($qpa,
 							 ') OR (') ;
 				$qpa = $this->addMatchCondition ($qpa, 'details') ;
 				$qpa = db_construct_qpa ($qpa,
-							 ')') ;
+							 '))') ;
 			}
 			if (count ($this->words)) {
 				$qpa = db_construct_qpa ($qpa,
-							 ') ORDER BY rank(vectors, q) DESC, post_date DESC') ;
+							 ') ORDER BY ts_rank(vectors, q) DESC, post_date DESC') ;
 			} else {
 				$qpa = db_construct_qpa ($qpa,
 							 ') ORDER BY post_date DESC') ;

Modified: branches/Branch_5_1/src/common/search/PeopleSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/PeopleSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/PeopleSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -51,7 +51,7 @@
 			if (count ($this->words)) {
 				$words = $this->getFormattedWords();
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT users.user_id, user_name, headline(realname, q) as realname FROM users, to_tsquery($1) AS q, users_idx WHERE status=$2 AND users_idx.user_id = users.user_id AND (vectors @@ q ',
+							 'SELECT users.user_id, user_name, ts_headline(realname, q) as realname FROM users, to_tsquery($1) AS q, users_idx WHERE status=$2 AND users_idx.user_id = users.user_id AND (vectors @@ q ',
 							 array ($words,
 								'A'));
 			} else {
@@ -75,7 +75,7 @@
 			}
 			if (count ($this->words)) {
 				$qpa = db_construct_qpa ($qpa,
-							 ') ORDER BY rank(vectors, q) DESC, user_name') ;
+							 ') ORDER BY ts_rank(vectors, q) DESC, user_name') ;
 			} else {
 				$qpa = db_construct_qpa ($qpa,
 							 ') ORDER BY user_name') ;

Modified: branches/Branch_5_1/src/common/search/ProjectSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/ProjectSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/ProjectSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -52,21 +52,21 @@
 			if (count ($this->words)) {
 				$words = $this->getFormattedWords();
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT DISTINCT ON (rank(vectors, q), group_name) type_id, g.group_id, headline(group_name, q) as group_name, unix_group_name, headline(short_description, q) as short_description FROM groups AS g, to_tsquery($1) AS q, groups_idx as i WHERE g.status in ($2, $3) ',
+							 'SELECT DISTINCT ON (ts_rank(vectors, q), group_name) type_id, g.group_id, ts_headline(group_name, q) as group_name, unix_group_name, ts_headline(short_description, q) as short_description FROM groups AS g, to_tsquery($1) AS q, groups_idx as i WHERE g.status in ($2, $3) ',
 							 array ($words,
 								'A',
 								'H')) ;
 				$qpa = db_construct_qpa ($qpa,
-							 'AND (vectors @@ q AND ') ;
+							 'AND vectors @@ q ') ;
 			} else {
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT DISTINCT ON (group_name) type_id, g.group_id, group_name, unix_group_name, short_description FROM groups AS g WHERE g.status in ($1, $2) AND (',
+							 'SELECT DISTINCT ON (group_name) type_id, g.group_id, group_name, unix_group_name, short_description FROM groups AS g WHERE g.status in ($1, $2) ',
 							 array ('A',
 								'H')) ;
 			}
 			if (count($this->phrases)) {
 				$qpa = db_construct_qpa ($qpa,
-							 '(') ;
+							 ' AND ((') ;
 				$qpa = $this->addMatchCondition($qpa, 'group_name');
 				$qpa = db_construct_qpa ($qpa,
 							 ') OR (') ;
@@ -75,13 +75,11 @@
 							 ') OR (') ;
 				$qpa = $this->addMatchCondition($qpa, 'unix_group_name');
 				$qpa = db_construct_qpa ($qpa,
-							 ') ') ;
-			}
-			$qpa = db_construct_qpa ($qpa,
-						 ') ') ;
+							 ')) ') ;
+			}				
 			if (count ($this->words)) {
 				$qpa = db_construct_qpa ($qpa,
-							 'AND g.group_id = i.group_id ORDER BY rank(vectors, q) DESC, group_name') ;
+							 'AND g.group_id = i.group_id ORDER BY ts_rank(vectors, q) DESC, group_name') ;
 			} else {
 				$qpa = db_construct_qpa ($qpa,
 							 'ORDER BY group_name') ;

Modified: branches/Branch_5_1/src/common/search/SkillSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/SkillSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/SkillSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -51,7 +51,7 @@
 			if(count($this->words)) {
 				$words = $this->getFormattedWords();
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT skills_data.skills_data_id, skills_data.type, skills_data.start, skills_data.finish, headline(skills_data.title, q) as title, headline(skills_data.keywords, q) as keywords FROM skills_data, users, skills_data_types, to_tsquery($1) AS q, skills_data_idx WHERE (vectors @@ q ',
+							 'SELECT skills_data.skills_data_id, skills_data.type, skills_data.start, skills_data.finish, ts_headline(skills_data.title, q) as title, ts_headline(skills_data.keywords, q) as keywords FROM skills_data, users, skills_data_types, to_tsquery($1) AS q, skills_data_idx WHERE (vectors @@ q ',
 							 array ($words)) ;
 			} else {
 				$qpa = db_construct_qpa ($qpa,
@@ -82,7 +82,7 @@
 						 'AND (skills_data.user_id=users.user_id) AND (skills_data.type=skills_data_types.type_id) ') ;
 			if (count ($this->words)) {
 				$qpa = db_construct_qpa ($qpa,
-							 'ORDER BY rank(vectors, q) DESC, finish DESC') ;
+							 'ORDER BY ts_rank(vectors, q) DESC, finish DESC') ;
 			} else {
 				$qpa = db_construct_qpa ($qpa,
 							 'ORDER BY finish DESC') ;

Modified: branches/Branch_5_1/src/common/search/TasksSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/TasksSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/TasksSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -74,7 +74,7 @@
 				$words = $this->getFormattedWords();
 
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT project_task.project_task_id, project_task.percent_complete, headline(project_task.summary, q) AS summary, project_task.start_date,project_task.end_date,users.firstname||$1||users.lastname AS realname, project_group_list.project_name, project_group_list.group_project_id FROM project_task, users, project_group_list, to_tsquery($2) AS q, project_task_idx WHERE project_task.created_by = users.user_id AND project_task.project_task_id = project_task_idx.project_task_id AND project_task.group_project_id = project_group_list.group_project_id AND project_group_list.group_id=$3 ',
+							 'SELECT project_task.project_task_id, project_task.percent_complete, ts_headline(project_task.summary, q) AS summary, project_task.start_date,project_task.end_date,users.firstname||$1||users.lastname AS realname, project_group_list.project_name, project_group_list.group_project_id FROM project_task, users, project_group_list, to_tsquery($2) AS q, project_task_idx WHERE project_task.created_by = users.user_id AND project_task.project_task_id = project_task_idx.project_task_id AND project_task.group_project_id = project_group_list.group_project_id AND project_group_list.group_id=$3 ',
 							 array (' ',
 								$words,
 								$this->groupId)) ;
@@ -110,7 +110,7 @@
 			}
 			if (count ($this->words)) {
 				$qpa = db_construct_qpa ($qpa,
-							 'ORDER BY project_group_list.project_name, rank(vectors, q) DESC, project_task.project_task_id') ;
+							 'ORDER BY project_group_list.project_name, ts_rank(vectors, q) DESC, project_task.project_task_id') ;
 			} else {
 				$qpa = db_construct_qpa ($qpa,
 							 'ORDER BY project_group_list.project_name, project_task.project_task_id') ;

Modified: branches/Branch_5_1/src/common/search/TrackersSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/TrackersSearchQuery.class.php	2011-08-12 15:30:34 UTC (rev 14113)
+++ branches/Branch_5_1/src/common/search/TrackersSearchQuery.class.php	2011-08-12 15:30:42 UTC (rev 14114)
@@ -72,7 +72,7 @@
 		if (forge_get_config('use_fti')) {
 			if (count ($this->words)) {
 				$qpa = db_construct_qpa ($qpa,
-							 'SELECT DISTINCT x.* FROM (SELECT artifact.artifact_id, artifact.group_artifact_id, artifact.summary, artifact.open_date, users.realname, artifact_group_list.name, (rank(artifact_idx.vectors, q)+rank(artifact_message_idx.vectors, q)) AS rank FROM artifact LEFT OUTER JOIN artifact_message USING (artifact_id), users, artifact_group_list, to_tsquery($1) q, artifact_idx, artifact_message_idx WHERE users.user_id = artifact.submitted_by AND artifact_idx.artifact_id = artifact.artifact_id AND artifact_message_idx.id = artifact_message.id AND artifact_message_idx.artifact_id = artifact_message_idx.artifact_id AND artifact_group_list.group_artifact_id = artifact.group_artifact_id AND artifact_group_list.group_id = $2 ',
+							 'SELECT DISTINCT x.* FROM (SELECT artifact.artifact_id, artifact.group_artifact_id, artifact.summary, artifact.open_date, users.realname, artifact_group_list.name, (ts_rank(artifact_idx.vectors, q)+ts_rank(artifact_message_idx.vectors, q)) AS rank FROM artifact LEFT OUTER JOIN artifact_message USING (artifact_id), users, artifact_group_list, to_tsquery($1) q, artifact_idx, artifact_message_idx WHERE users.user_id = artifact.submitted_by AND artifact_idx.artifact_id = artifact.artifact_id AND artifact_message_idx.id = artifact_message.id AND artifact_message_idx.artifact_id = artifact_message_idx.artifact_id AND artifact_group_list.group_artifact_id = artifact.group_artifact_id AND artifact_group_list.group_id = $2 ',
 							 
 							 array ($this->getFormattedWords(),
 								$this->groupId)) ;




More information about the Fusionforge-commits mailing list