Skip to:
Content

Opened 4 years ago

Closed 4 years ago

#1222 closed defect (fixed)

Search - Relevant Post Links Broken

Reported by: hpguru Owned by: chrishajer
Milestone: 1.0.3 Priority: high
Severity: major Version: 1.0.2
Component: Back-end Keywords: has-patch tested
Cc:

Description

Search has a bug. Some posts links broken! http://bbpress.org/forums/topic/search-relevant-post-links-broken

Attachments (3)

search.php.diff (974 bytes) - added by Gautam Gupta 4 years ago.
Basic patch, can be improved upon.
search.php.2.diff (928 bytes) - added by GautamGupta 4 years ago.
Do not limit posts nor order by time
1222.diff (493 bytes) - added by GautamGupta 4 years ago.
A simple patch for the second problem

Download all attachments as: .zip

Change History (21)

comment:1 hpguru4 years ago

  • Summary changed from Search no work good to Search - Relevant Post Links Broken

comment:2 matveb4 years ago

To replicate this bug:

  1. On fresh installation create a new topic. Title being "Lorem ipsum", and content being "Debug search".
  2. Then search for "debug". The created topic should appear both under "Recent Posts" and "Relevant posts".

Result: the topic link for the second result --under "Relevant posts"-- should be set incorrectly without any id.

The bug, I believe, comes form search.php and only occurs for topics under "Relevant posts" when they have already been displayed on "Recent posts". If you erase the $bb_query_form->BB_Query_Form in search.php for $recent = $bb_query_form->results; the topic link under "Relevant posts" works fine.

So there is some overlapping in the queries when fetching the same post both times which renders the second link without an id.

comment:3 Gautam Gupta4 years ago

  • Keywords has-patch needs-testing search added; Search removed
  • Severity changed from normal to major

Error verified. Attaching patch, which can be improved upon.

Gautam Gupta4 years ago

Basic patch, can be improved upon.

comment:4 chrishajer4 years ago

  • Owner set to chrishajer
  • Status changed from new to assigned

comment:5 GautamGupta4 years ago

  • Keywords search removed

GautamGupta4 years ago

Do not limit posts nor order by time

comment:6 GautamGupta4 years ago

  • Keywords tested added; needs-testing removed

I think the search.php.2.diff would work good.

comment:7 chrishajer4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [2414]) Fix Relevant Post links in search results. Fixes #1222. Props GautamGupta

comment:8 mr_pelle4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I found a new bug, consequence of this patch:

To replicate this bug: 1. Make a search. 2. Make the same search.

Result: no results shown.

This happens because search form id changed from topic-search-form to post-search-form.

comment:9 Markus Pezold4 years ago

I can't replicate this bug on my own customized theme (Scoun).
After the first test I go around to my test-forum with many other themes - For me it seems the bug is only in themes with two different search-forms!

The second search changes the url-param:

  1. http://bbpress.org/forums/search.php?q=topic
  2. http://bbpress.org/forums/search.php?post_text=topic&forum_id=0

comment:10 mr_pelle4 years ago

Yes, the url-param changes, and that's what breaks the search.
I've also found out that a third search completes correctly... o_0"

comment:11 mr_pelle4 years ago

I've experienced the bug with Kakumei too; the search form also loses its styling, since its id changes.

GautamGupta4 years ago

A simple patch for the second problem

comment:12 GautamGupta4 years ago

The problem was that when we changed the relevant search's type to post, $bb_query_form->type was also changed to it and the bb_topic_search_form() function uses that to determine what name should be given to the form, which created the problem.

I have attached the patch which would fix this problem.

comment:13 mr_pelle4 years ago

Works perfectly, great work!
We can close this ticket.

comment:14 chrishajer4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [2429]) Reported by mr_pelle. Patch in 2414 broke relevant search results. Fixes #1222. Props GautamGupta

comment:15 mr_pelle4 years ago

  • Severity changed from major to critical

Last patch broke something huge: now every search I make returns me every post in the forum! =P
I didn't know if to open a new ticket, because this new bug is caused by this ticket's last patch...

comment:16 mr_pelle4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:17 mr_pelle4 years ago

Little correction: if you select a forum to search into, search returns all the posts in that forum. If not (i.e. Any is selected), search returns all the posts in your forum.

comment:18 GautamGupta4 years ago

  • Resolution set to fixed
  • Severity changed from critical to major
  • Status changed from reopened to closed

Yes, you're right. I've opened a new ticket for this - #1274

Note: See TracTickets for help on using tickets.