The search code is a bit unwieldy
The search-related code grew organically, and as a result it is a bit unwieldy.
There are basically two code paths:
- one for the global search (yes, we have one, even though it doesn't seem to be exposed in the UI anywhere)
- one for the specific searches (e.g filtering medias in the mediacenter index page)
Those two branches have pretty much nothing in common. They both do their own thing until, at the very end, they call Search.objects.filter(**kwargs)
.
I wonder if we can't make them share much, much more code.
As it is, each change must be done on both branch.
I'm also worried the global search doesn't actually work well, as it doesn't seem to be visible in the UI and we might not have tested it in a while. (if ever)
This really calls for some refactoring, let's see if we can make it better.