mardi 24 mars 2015

Error searching multiple models with Sunspot Solr Rails 3

Finally got Sunspot working when searching a single model, but running into some problems when searching multiple.


The error that I'm getting after making a search:



Missing template search/index, application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "/Users/Indokathan/code/iibfy/app/views" * "/usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.4.1/app/views"


search.rb



class Search < ActiveRecord::Base
attr_accessible :title

searchable do
text :title
end
end


search_controller.rb



class SearchController < ApplicationController

def index
@search = Sunspot.search [Dairy, Drink] do
fulltext params[:search]
end
@results = @search.results
end
end


searchbar.html.erb



<%= form_tag search_index_path, :method => :get do %>
<p>
<%= text_field_tag :search, params[:search], style:"width:550px; height:30px;" %><br>
<%= submit_tag "Search!", :name => nil, class: "btn btn-primary btn-lg", style: "margin-top:10px" %>
</p>


Any help as to why I am getting this error would be more than appreciated. If you need any more info please let me know.


Aucun commentaire:

Enregistrer un commentaire