pg_search icon indicating copy to clipboard operation
pg_search copied to clipboard

How to search for everything

Open antarr opened this issue 4 years ago • 1 comments

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?

antarr avatar Feb 04 '21 06:02 antarr

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)

archonic avatar Sep 05 '23 01:09 archonic