pg_search
pg_search copied to clipboard
How to search for everything
I'm switching from searchkick which uses elastic search. In that library, you are able to search for everything using * like `.
Searchkick.search('*',
where: { updated_at: { gt: since }, state_id: filters[:state_id] },
models: search_models,
order: sorting,
boost_by_recency: { created_at: { scale: '7d', decay: 0.5 } },
page: params[:page], per_page: 10)
Does pg_search provide anything like this when using multisearchable?
I just avoid calling search on the relation. Like this:
results = Document.where(where_conditions)
results = results.search(params[:q]) if !params[:q].blank?
@pagy, @documents = pagy(results)