Note on the search_for_admin
implementation: initially, I’ve reused search
function to implement search for admin API, but, since we need to have pagination, thus we need to know the total number of found records I need to use one of the search function (either fts_search_subquery
or trigram_search_subquery
) in order to be able to count the total (since we’re finding duplicate users when doing search
and then eliminating duplicates with Enum.uniq_by/2
)