mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[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
This commit is contained in:
parent
7ca762c524
commit
274c83c74d
1 changed files with 3 additions and 5 deletions
|
@ -457,15 +457,13 @@ class fulltext_postgres extends \phpbb\search\base
|
||||||
$sql_where_options .= $sql_match_where;
|
$sql_where_options .= $sql_match_where;
|
||||||
|
|
||||||
$tmp_sql_match = array();
|
$tmp_sql_match = array();
|
||||||
foreach (explode(',', $sql_match) as $sql_match_column)
|
$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) . "')";
|
||||||
$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) . "')";
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->sql_transaction('begin');
|
$this->db->sql_transaction('begin');
|
||||||
|
|
||||||
$sql_from = "FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p";
|
$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_where_options";
|
||||||
$sql = "SELECT $sql_select
|
$sql = "SELECT $sql_select
|
||||||
$sql_from
|
$sql_from
|
||||||
|
|
Loading…
Add table
Reference in a new issue