Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • funkwhale funkwhale
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 409
    • Issues 409
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 19
    • Merge requests 19
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • funkwhalefunkwhale
  • funkwhalefunkwhale
  • Merge requests
  • !975

Resolve "Switch to proper full-text-search system"

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Agate requested to merge 994-full-text-search into develop Dec 18, 2019
  • Overview 0
  • Commits 10
  • Pipelines 3
  • Changes 14

Closes #994 (closed)

I initially pushed on develop by mistake so I had to revert then rerevert…

Anyway, this leveragaes django and PostgreSQL Full-Text-Search capabilities (https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/search/#searchvectorfield):

  1. Add a new body_text column on artists, albums, and tracks, with a tsvector type
  2. Populate this field with adequate data from the corresponding objects (title for tracks and albums, name for artists)
  3. Use this new field for our search (instead of the %LIKE% queries spanning multiple fields we had before
  4. Enjoy the performance improvements (between x2 and x5 in terms of speed during my local tests, possibly even higher on more modest hardware or bigger databases).

I also add to add database triggers on Postgresql to ensure the body_text field is synchronized properly whenever an object is updated.

Sidenote: I've included some new tests for the search endpoint (it wasn't covered), and a feature flag to ensure we can revert back to the old logic in case anything goes wrong.

Edited Dec 18, 2019 by Agate
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: 994-full-text-search