Multisearch will always return PgSearch::Document
records.
If you want to query your model directly, you can define a pg_search_scope
, e.g.:
pg_search_scope :custom_search, :against => [:title] # Can use multiple fields
And then use it with search = Model.custom_search(params[:search])
, which will return Model
records.
Also, a cleaner way to write your code above would be:
search = PgSearch.multisearch(params[:search])
@items = search.map(&:searchable)