Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix searching titles in discussions #2698

Merged
merged 5 commits into from
Apr 20, 2021
Merged

Conversation

askvortsov1
Copy link
Member

Changes proposed in this pull request:
This was originally attempted in #1741, but reverted in 9f6ec80 due to performance issues. From pure speculation, this should not cause such issues. From local dev environment testing (on a small dataset), that claim holds.

Implementation:
Instead of using a left join to include discussions, we add an additional subquery where we search discussions by title, union that into the posts subquery, and only then join.

Reviewers should focus on:

  • This MUST be tested for performance on a large site before we consider merging it.

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).

Copy link
Contributor

@tankerkiller125 tankerkiller125 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been running on https://discuss.flarum.org for about a week now with excellent results.

There has been no noticeable changes to resources used on the VPS and the search seems to be just as fast as it was without title searching.

@askvortsov1 askvortsov1 added this to the 1.0 milestone Apr 16, 2021
Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with a 700K discussions database, the search time was the same before and after.

Based on that, I'm approving this.

@tankerkiller125 tankerkiller125 merged commit 1f2411e into master Apr 20, 2021
@tankerkiller125 tankerkiller125 deleted the as/discussion-title-search branch April 20, 2021 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants