mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/17491] Fix rows duplication in search results
PHPBB-17491
This commit is contained in:
parent
1c399dcab7
commit
3d76a8bd09
4 changed files with 8 additions and 1 deletions
|
@ -832,6 +832,8 @@ class fulltext_mysql extends \phpbb\search\base
|
||||||
// Build the query for really selecting the post_ids
|
// Build the query for really selecting the post_ids
|
||||||
if ($type == 'posts')
|
if ($type == 'posts')
|
||||||
{
|
{
|
||||||
|
// For sorting by non-unique columns, add unique sort key to avoid duplicated rows in results
|
||||||
|
$sql_sort .= ', p.post_id' . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
||||||
$sql = "SELECT $sql_select
|
$sql = "SELECT $sql_select
|
||||||
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . "
|
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . "
|
||||||
WHERE $sql_author
|
WHERE $sql_author
|
||||||
|
|
|
@ -1251,6 +1251,8 @@ class fulltext_native extends \phpbb\search\base
|
||||||
// Build the query for really selecting the post_ids
|
// Build the query for really selecting the post_ids
|
||||||
if ($type == 'posts')
|
if ($type == 'posts')
|
||||||
{
|
{
|
||||||
|
// For sorting by non-unique columns, add unique sort key to avoid duplicated rows in results
|
||||||
|
$sql_sort .= ', p.post_id' . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
||||||
$sql = "SELECT $select
|
$sql = "SELECT $select
|
||||||
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t' : '') . "
|
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t' : '') . "
|
||||||
WHERE $sql_author
|
WHERE $sql_author
|
||||||
|
|
|
@ -764,6 +764,8 @@ class fulltext_postgres extends \phpbb\search\base
|
||||||
// Build the query for really selecting the post_ids
|
// Build the query for really selecting the post_ids
|
||||||
if ($type == 'posts')
|
if ($type == 'posts')
|
||||||
{
|
{
|
||||||
|
// For sorting by non-unique columns, add unique sort key to avoid duplicated rows in results
|
||||||
|
$sql_sort .= ', p.post_id' . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
||||||
$sql = "SELECT p.post_id
|
$sql = "SELECT p.post_id
|
||||||
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . "
|
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . "
|
||||||
WHERE $sql_author
|
WHERE $sql_author
|
||||||
|
|
|
@ -300,7 +300,8 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
||||||
);
|
);
|
||||||
|
|
||||||
// Browse the rest of search results pages with new sort direction
|
// Browse the rest of search results pages with new sort direction
|
||||||
foreach (range(2, $last_page) as $page_number)
|
$pages = range(2, $last_page);
|
||||||
|
foreach ($pages as $page_number)
|
||||||
{
|
{
|
||||||
$crawler = self::$client->click($pagination->selectLink($page_number)->link());
|
$crawler = self::$client->click($pagination->selectLink($page_number)->link());
|
||||||
$pagination = $crawler->filter('.pagination')->eq(0);
|
$pagination = $crawler->filter('.pagination')->eq(0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue