mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/17491] Consistently apply array_unique to search results
PHPBB-17491
This commit is contained in:
parent
e91c7d42a9
commit
1c399dcab7
3 changed files with 12 additions and 11 deletions
|
@ -609,7 +609,6 @@ class fulltext_mysql extends \phpbb\search\base
|
||||||
}
|
}
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$id_ary = array_unique($id_ary);
|
|
||||||
// if the total result count is not cached yet, retrieve it from the db
|
// if the total result count is not cached yet, retrieve it from the db
|
||||||
if (!$result_count && count($id_ary))
|
if (!$result_count && count($id_ary))
|
||||||
{
|
{
|
||||||
|
@ -635,10 +634,10 @@ class fulltext_mysql extends \phpbb\search\base
|
||||||
$id_ary[] = (int) $row[$field];
|
$id_ary[] = (int) $row[$field];
|
||||||
}
|
}
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$id_ary = array_unique($id_ary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id_ary = array_unique($id_ary);
|
||||||
|
|
||||||
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
||||||
$this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
$this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||||
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
||||||
|
@ -896,10 +895,10 @@ class fulltext_mysql extends \phpbb\search\base
|
||||||
$id_ary[] = (int) $row[$field];
|
$id_ary[] = (int) $row[$field];
|
||||||
}
|
}
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$id_ary = array_unique($id_ary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id_ary = array_unique($id_ary);
|
||||||
|
|
||||||
if (count($id_ary))
|
if (count($id_ary))
|
||||||
{
|
{
|
||||||
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||||
|
|
|
@ -1012,6 +1012,8 @@ class fulltext_native extends \phpbb\search\base
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id_ary = array_unique($id_ary);
|
||||||
|
|
||||||
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
||||||
$this->save_ids($search_key, $this->search_query, $author_ary, $total_results, $id_ary, $start, $sort_dir);
|
$this->save_ids($search_key, $this->search_query, $author_ary, $total_results, $id_ary, $start, $sort_dir);
|
||||||
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
||||||
|
@ -1313,6 +1315,8 @@ class fulltext_native extends \phpbb\search\base
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id_ary = array_unique($id_ary);
|
||||||
|
|
||||||
if (count($id_ary))
|
if (count($id_ary))
|
||||||
{
|
{
|
||||||
$this->save_ids($search_key, '', $author_ary, $total_results, $id_ary, $start, $sort_dir);
|
$this->save_ids($search_key, '', $author_ary, $total_results, $id_ary, $start, $sort_dir);
|
||||||
|
|
|
@ -545,8 +545,6 @@ class fulltext_postgres extends \phpbb\search\base
|
||||||
}
|
}
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$id_ary = array_unique($id_ary);
|
|
||||||
|
|
||||||
// if the total result count is not cached yet, retrieve it from the db
|
// if the total result count is not cached yet, retrieve it from the db
|
||||||
if (!$result_count)
|
if (!$result_count)
|
||||||
{
|
{
|
||||||
|
@ -576,10 +574,10 @@ class fulltext_postgres extends \phpbb\search\base
|
||||||
$id_ary[] = $row[$field];
|
$id_ary[] = $row[$field];
|
||||||
}
|
}
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$id_ary = array_unique($id_ary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id_ary = array_unique($id_ary);
|
||||||
|
|
||||||
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
||||||
$this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
$this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||||
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
||||||
|
@ -858,10 +856,10 @@ class fulltext_postgres extends \phpbb\search\base
|
||||||
$id_ary[] = (int) $row[$field];
|
$id_ary[] = (int) $row[$field];
|
||||||
}
|
}
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$id_ary = array_unique($id_ary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id_ary = array_unique($id_ary);
|
||||||
|
|
||||||
if (count($id_ary))
|
if (count($id_ary))
|
||||||
{
|
{
|
||||||
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||||
|
|
Loading…
Add table
Reference in a new issue