I'm using solr for search.
In my model Client:
searchable do
text :name
end
And controller Client:
def index
@search = Client.search do
fulltext params[:search]
end
@clients = @search.results
end
The in console:
cli = Client.search
=> <Sunspot::Search:{:fq=>["type:Client"], :start=>0, :rows=>30, :q=>"*:*"}>
How to get the type of object (client)?
cli = cli.fq (undefined method `fq' for #<Sunspot::Search::StandardSearch:0xd22ab0c>)
cli = cli.type (undefined method `type' for #<Sunspot::Search::StandardSearch:0xd22ab0c>)
I had needed this once and found no solution.
I did find a workaround that is valid, but I don't know if it is the most correct way to go: