Add support for `search_fields` param in Labels API
Summary
Currently while using Labels Public API (both Group and Project), searching for labels includes matches for both title
and description
fields, this has a couple of problems;
- On UI, we don't show description of labels in places like dropdowns and filtered search, hence the results that user will see might be misleading because the response returned by API is paginated.
- Given that description is included during the search, fetching the results takes around
4 seconds
forgitlab-org
group where we have over 1400 labels to search from.
Proposal
We can introduce a query param to the existing API called search_fields
, which accepts array of fields that search needs to use as a look-up, by default this can continue to include both title
and description
(thus being backwards compatible), but in places where the title-based search is more relevant, we can override the behaviour by passing search_fields = ['title']
during the request. This may also yield much faster results compared to default behaviour.