Skip to content

Commit 91e71a0

Browse files
authored
Merge pull request #421 from phpbb/fix/post_search
Remove manual offsetting of IDs since this is not needed with real id
2 parents be0ee17 + 2f18a83 commit 91e71a0

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

controller/search.php

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -619,13 +619,6 @@ protected function query_index()
619619

620620
$this->sort->total = $results['total'];
621621

622-
// https://tracker.phpbb.com/projects/CUSTDB/issues/CUSTDB-813
623-
// In Sphinx context ids are incremented with a specific value:
624-
// 20000000 for posts
625-
// 10000000 for FAQ
626-
627-
$is_sphinx = $this->engine->get_name() === 'phpbb.titania.search.driver.fulltext_sphinx';
628-
629622
foreach ($results['documents'] as $data)
630623
{
631624
switch ($data['type'])
@@ -637,11 +630,11 @@ protected function query_index()
637630
case ext::TITANIA_SUPPORT:
638631
case ext::TITANIA_QUEUE_DISCUSSION:
639632
case ext::TITANIA_QUEUE :
640-
$posts[] = $is_sphinx ? $data['id'] - 20000000 : $data['id'];
633+
$posts[] = $data['id'];
641634
break;
642635

643636
case ext::TITANIA_FAQ:
644-
$faqs[] = $is_sphinx ? $data['id'] - 10000000 : $data['id'];
637+
$faqs[] = $data['id'];
645638
break;
646639
}
647640
}
@@ -650,8 +643,8 @@ protected function query_index()
650643
if ($results['documents'])
651644
{
652645
$results['documents'] = $this->get_contribs($contribs, $results['documents']);
653-
$results['documents'] = $this->get_posts($posts, $results['documents'], $is_sphinx);
654-
$results['documents'] = $this->get_faqs($faqs, $results['documents'], $is_sphinx);
646+
$results['documents'] = $this->get_posts($posts, $results['documents']);
647+
$results['documents'] = $this->get_faqs($faqs, $results['documents']);
655648
}
656649
return $results;
657650
}
@@ -661,10 +654,9 @@ protected function query_index()
661654
*
662655
* @param array $ids
663656
* @param array $documents
664-
* @param bool $is_sphinx
665657
* @return array
666658
*/
667-
protected function get_posts(array $ids, array $documents, bool $is_sphinx)
659+
protected function get_posts(array $ids, array $documents)
668660
{
669661
if (!$ids)
670662
{
@@ -680,7 +672,7 @@ protected function get_posts(array $ids, array $documents, bool $is_sphinx)
680672

681673
while ($row = $this->db->sql_fetchrow($result))
682674
{
683-
$id = $row['post_type'] . '_' . ($is_sphinx ? $row['id'] + 20000000 : $row['id']);
675+
$id = $row['post_type'] . '_' . $row['id'];
684676

685677
// Unserialize existing URL parameters (contains contrib_type and contrib)
686678
$url_params = unserialize($row['url'], ['allowed_classes' => false]);
@@ -749,10 +741,9 @@ protected function get_contribs(array $ids, array $documents)
749741
*
750742
* @param array $ids
751743
* @param array $documents
752-
* @param bool $is_sphinx
753744
* @return array
754745
*/
755-
protected function get_faqs(array $ids, array $documents, bool $is_sphinx)
746+
protected function get_faqs(array $ids, array $documents)
756747
{
757748
if (!$ids)
758749
{
@@ -770,7 +761,7 @@ protected function get_faqs(array $ids, array $documents, bool $is_sphinx)
770761

771762
while ($row = $this->db->sql_fetchrow($result))
772763
{
773-
$id = ext::TITANIA_FAQ . '_' . ($is_sphinx ? $row['id'] + 10000000 : $row['id']);
764+
$id = ext::TITANIA_FAQ . '_' . $row['id'];
774765

775766
$contrib_type_obj = $this->types->get($row['contrib_type']);
776767

0 commit comments

Comments
 (0)