Pergunta

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
Foi útil?

Solução

Get the search result using

@result = @search.results

Take a look at this railscasts tutorial

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top