I am having some trouble with Sunspot and Solr. When I pass a parameter, I'm getting no results. I've included in the comments at 2 points in the code.

I've confirmed that there is also data in the Review table in my db and that the string does occur in the records.

Any advice on how to return the search results?

    puts "search query is #{params[:search]}"   //returns search query 
    if params[:search]
        @search = Review.search do
            fulltext params[:search]
        end
        puts "search results are #{@search.results}"   //returns []
        @reviews_search_results = @search.results
    end
有帮助吗?

解决方案

Get the search result using

@result = @search.results

Take a look at this railscasts tutorial

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top