Merged requested to merge 994-full-text-search into develop
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):
- Add a new
body_textcolumn on artists, albums, and tracks, with a
- Populate this field with adequate data from the corresponding objects (title for tracks and albums, name for artists)
- Use this new field for our search (instead of the
%LIKE%queries spanning multiple fields we had before
- 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.