aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/search/fulltext_postgres.php
diff options
context:
space:
mode:
authorDhruv <dhruv.goel92@gmail.com>2012-08-12 01:25:01 +0530
committerDhruv <dhruv.goel92@gmail.com>2014-03-12 11:01:21 +0530
commit274c83c74d128fc2e5a63c7c178250c862f90182 (patch)
tree600faeba02a3859783aaf9f4039efbad7d01f7b3 /phpBB/phpbb/search/fulltext_postgres.php
parent7ca762c5247c9be0ff6beef03162e4b81dbf2c73 (diff)
downloadforums-274c83c74d128fc2e5a63c7c178250c862f90182.tar
forums-274c83c74d128fc2e5a63c7c178250c862f90182.tar.gz
forums-274c83c74d128fc2e5a63c7c178250c862f90182.tar.bz2
forums-274c83c74d128fc2e5a63c7c178250c862f90182.tar.xz
forums-274c83c74d128fc2e5a63c7c178250c862f90182.zip
[ticket/11040] Search subject and text together
Instead of searching for post_subject and post_text seperately and then OR them in where clause we use concatenation of the two columns and search PHPBB3-11040
Diffstat (limited to 'phpBB/phpbb/search/fulltext_postgres.php')
-rw-r--r--phpBB/phpbb/search/fulltext_postgres.php8
1 files changed, 3 insertions, 5 deletions
diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php
index 063bf52a19..7df61ee583 100644
--- a/phpBB/phpbb/search/fulltext_postgres.php
+++ b/phpBB/phpbb/search/fulltext_postgres.php
@@ -457,15 +457,13 @@ class fulltext_postgres extends \phpbb\search\base
$sql_where_options .= $sql_match_where;
$tmp_sql_match = array();
- foreach (explode(',', $sql_match) as $sql_match_column)
- {
- $tmp_sql_match[] = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match_column . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')";
- }
+ $sql_match = str_replace(',', " || ' ' ||", $sql_match);
+ $tmp_sql_match = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')";
$this->db->sql_transaction('begin');
$sql_from = "FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p";
- $sql_where = "WHERE (" . implode(' OR ', $tmp_sql_match) . ")
+ $sql_where = "WHERE (" . $tmp_sql_match . ")
$sql_where_options";
$sql = "SELECT $sql_select
$sql_from