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

Roland Mas lolando at fusionforge.org
Fri Oct 7 16:31:41 CEST 2011


Author: lolando
Date: 2011-10-07 16:31:41 +0200 (Fri, 07 Oct 2011)
New Revision: 14574

Modified:
   branches/Branch_5_1/
   branches/Branch_5_1/src/common/search/DocsSearchQuery.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/NewsSearchQuery.class.php
   branches/Branch_5_1/src/common/search/SearchQuery.class.php
   branches/Branch_5_1/src/common/search/TasksSearchQuery.class.php
   branches/Branch_5_1/src/common/search/TrackersSearchQuery.class.php
Log:
Refactor field separator

Modified: branches/Branch_5_1/src/common/search/DocsSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/DocsSearchQuery.class.php	2011-10-07 14:31:31 UTC (rev 14573)
+++ branches/Branch_5_1/src/common/search/DocsSearchQuery.class.php	2011-10-07 14:31:41 UTC (rev 14574)
@@ -72,7 +72,7 @@
 			$qpa = db_construct_qpa () ;
 			$qpa = db_construct_qpa ($qpa,
 						 'SELECT x.* FROM (SELECT doc_data.docid, doc_data.title, doc_data.filename, doc_data.description, doc_groups.groupname, title||$1||description AS full_string_agg FROM doc_data, doc_groups WHERE doc_data.doc_group = doc_groups.doc_group AND doc_data.group_id = $2',
-						 array (' //// ',
+						 array ($this->field_separator,
 							$this->groupId)) ;
 			if ($this->sections != SEARCH__ALL_SECTIONS) {
 				$qpa = db_construct_qpa ($qpa,
@@ -103,7 +103,7 @@
 
 		$qpa = db_construct_qpa ($qpa,
 					 'SELECT x.* FROM (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, title||$1||description AS full_string_agg, doc_data_idx.vectors FROM doc_data, doc_groups, doc_data_idx, to_tsquery($2) AS q',
-					 array (' //// ',
+					 array ($this->field_separator,
 						$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 @@ $1',

Modified: branches/Branch_5_1/src/common/search/ForumSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/ForumSearchQuery.class.php	2011-10-07 14:31:31 UTC (rev 14573)
+++ branches/Branch_5_1/src/common/search/ForumSearchQuery.class.php	2011-10-07 14:31:41 UTC (rev 14574)
@@ -70,7 +70,7 @@
 			$qpa = db_construct_qpa ($qpa,
 						 '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, forum.subject||$2||forum.body as full_string_agg WHERE forum.group_forum_id = $3 AND forum.posted_by = users.user_id AND fi.msg_id = forum.msg_id AND vectors @@ q ',
 						 array ($words,
-							' //// ',
+							$this->field_separator,
 							$this->forumId)) ;
 			$phraseOp = $this->getOperator();
 
@@ -86,7 +86,7 @@
 		} else {
 			$qpa = db_construct_qpa ($qpa,
 						 'SELECT forum.msg_id, forum.subject, forum.post_date, users.realname, forum.subject||$1||forum.body as full_string_agg FROM forum,users WHERE users.user_id=forum.posted_by AND (',
-						 array (' //// ')) ;
+						 array ($this->field_separator)) ;
 			$qpa = $this->addIlikeCondition ($qpa, 'full_string_agg') ;
 			$qpa = db_construct_qpa ($qpa,
 						 ') AND forum.group_forum_id=$1 GROUP BY msg_id, subject, post_date, realname',

Modified: branches/Branch_5_1/src/common/search/ForumsSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/ForumsSearchQuery.class.php	2011-10-07 14:31:31 UTC (rev 14573)
+++ branches/Branch_5_1/src/common/search/ForumsSearchQuery.class.php	2011-10-07 14:31:41 UTC (rev 14574)
@@ -82,7 +82,7 @@
 			$qpa = db_construct_qpa ($qpa,
 						 'SELECT forum.msg_id, ts_headline(forum.subject, q) AS subject, forum.post_date, users.realname, forum_group_list.forum_name, forum.subject||$2||forum.body as full_string_agg FROM forum, users, forum_group_list, forum_idx, to_tsquery($1) as q ',
 						 array ($this->getFTIwords(),
-							' //// ')) ;
+							$this->field_separator)) ;
 			$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) ',
 						 array ($this->groupId));
@@ -109,7 +109,7 @@
 		} else {
 			$qpa = db_construct_qpa ($qpa,
 						 'SELECT x.* FROM (SELECT forum.msg_id, forum.subject, forum.post_date, users.realname, forum_group_list.forum_name, forum.subject||$1||forum.body as full_string_agg 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 = $2) ',
-						 array (' //// ',
+						 array ($this->field_separator,
 							$this->groupId)) ;
 			if ($this->sections != SEARCH__ALL_SECTIONS) {
 				$qpa = db_construct_qpa ($qpa,

Modified: branches/Branch_5_1/src/common/search/NewsSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/NewsSearchQuery.class.php	2011-10-07 14:31:31 UTC (rev 14573)
+++ branches/Branch_5_1/src/common/search/NewsSearchQuery.class.php	2011-10-07 14:31:41 UTC (rev 14574)
@@ -62,7 +62,7 @@
 			$words = $this->getFTIwords();
 			$qpa = db_construct_qpa ($qpa,
 						 'SELECT x.* FROM (SELECT ts_headline(news_bytes.summary, q) as summary, news_bytes.post_date, news_bytes.forum_id, users.realname, summary||$1||details AS full_string_agg, news_bytes_idx.vectors FROM news_bytes, users, to_tsquery($2) AS q, news_bytes_idx WHERE (news_bytes.group_id=$3 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) AS x ',
-						 array (' //// ',
+						 array ($this->field_separator,
 							$words,
 							$group_id)) ;
 			if (count ($this->phrases)) {
@@ -76,7 +76,7 @@
 		} else {
 			$qpa = db_construct_qpa ($qpa,
 						 'SELECT x.* FROM (SELECT news_bytes.summary, news_bytes.post_date, news_bytes.forum_id, users.realname, summary||$1||details AS full_string_agg FROM news_bytes, users WHERE group_id=$2 AND is_approved <> 4 AND news_bytes.submitted_by = users.user_id) AS x WHERE ',
-						 array (' //// ',
+						 array ($this->field_separator,
 							$this->groupId)) ;
 			$qpa = $this->addIlikeCondition ($qpa, 'full_string_agg') ;
 			$qpa = db_construct_qpa ($qpa,

Modified: branches/Branch_5_1/src/common/search/SearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/SearchQuery.class.php	2011-10-07 14:31:31 UTC (rev 14573)
+++ branches/Branch_5_1/src/common/search/SearchQuery.class.php	2011-10-07 14:31:41 UTC (rev 14574)
@@ -83,6 +83,9 @@
 
 	var $phrases = array();
 
+	// Something that's hopefully not going to end up in real data
+	var $field_separator = ' ioM0Thu6_fieldseparator_kaeph9Ee ';
+
 	/**
 	 * Constructor
 	 *

Modified: branches/Branch_5_1/src/common/search/TasksSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/TasksSearchQuery.class.php	2011-10-07 14:31:31 UTC (rev 14573)
+++ branches/Branch_5_1/src/common/search/TasksSearchQuery.class.php	2011-10-07 14:31:41 UTC (rev 14574)
@@ -69,7 +69,7 @@
 
 		$qpa = db_construct_qpa ($qpa,
 					 'SELECT x.* FROM (SELECT project_task.project_task_id, project_task.summary, project_task.percent_complete, project_task.start_date, project_task.end_date, users.realname, project_group_list.project_name, project_task.summary||$1||project_task.details||$1||coalesce(string_agg(project_messages.body, $1), $2) as full_string_agg',
-					 array (' //// ', ' '));
+					 array ($this->field_separator, ' '));
 		if (forge_get_config('use_fti')) {
 			$words = $this->getFTIwords();
 			$qpa = db_construct_qpa ($qpa,

Modified: branches/Branch_5_1/src/common/search/TrackersSearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/TrackersSearchQuery.class.php	2011-10-07 14:31:31 UTC (rev 14573)
+++ branches/Branch_5_1/src/common/search/TrackersSearchQuery.class.php	2011-10-07 14:31:41 UTC (rev 14574)
@@ -69,7 +69,7 @@
 
 		$qpa = db_construct_qpa ($qpa,
 					 'SELECT x.* FROM (SELECT artifact.artifact_id, artifact.group_artifact_id, artifact.summary, artifact.open_date, users.realname, artifact_group_list.name, artifact.summary||$1||artifact.details||$1||coalesce(string_agg(artifact_message.body, $1), $2) as full_string_agg',
-						 array (' //// ', ' '));
+						 array ($this->field_separator, ' '));
 		if (forge_get_config('use_fti')) {
 			$words = $this->getFTIwords();
 			$qpa = db_construct_qpa ($qpa,




More information about the Fusionforge-commits mailing list