Inconsistent search results with recent items autocompletes

Problem

As noticed in #434026 (comment 1773677533) we sometimes get autocomplete results for "recent items" when we use a single character and we sometimes do not.

Checking the performance bar I can see we're always issuing searches for issues, epics and MRs even for a single character but sometimes they give no results.

Furthermore it seems issues, epics and MR recent items are behaving quite differently. I believe this is because issues uses PG full text search while the others use ILIKE queries.

Solution

Figure out what's wrong with the searches and fix them.

Technical notes

Merge requests/Epics

For Merge Requests and Epics I can see the filter behaves very differently for 2 and 3 letter searches which is due to https://gitlab.com/gitlab-org/gitlab/-/blob/d3700d6041221d1c5667cb5cb114018c9fa4d44b/lib/gitlab/sql/pattern.rb#L37 . For the case of less than 3 letters our finders by default are doing an exact match. So searching ex does title ILIKE 'ex', while searching for exa does title ILIKE '%exa%'.

Presumably this exists because we can't use trigram indexes efficiently when there are less than 3 characters. This might be an issue for other kinds of searches but searching for recent items should still allow this because we always limit you to searching 100 ids at a time so it could always use those 100 ids for filtering and likely that would usually be more performant than the trigram indexes anyway.

It seems there is a param we can pass through use_minimum_char_limit which may need to be added to IssuableFinder to fix this. We can disable this limit for recent items searching.

Issues

The issue search works differently because we have the issue_search_data table which is used with postgres full text search. In the case of recent items search we shouldn't actually be using PG full text search since it's meant to behave as an ILIKE substring match and be very flexible because it only needs to match the 100 most recent issues. So we should force the issue searches to use the exact same code path as MRs and Epics. Today the issue search actually seems to work for single characters some of the time.