Reputation: 1210
I'm trying to get Thinking Sphinx running on my site but I'm not sure how to set up the search box and button for the index page. I have in my model:
define_index do
indexes :name
indexes description
where "approved = 'true'"
end
In my controller:
def index
@businesses = Business.search params[:search]
end
And in my index.html.erb I installed the autocomplete plugin and have:
<h3>Search Business</h3><%= text_field_with_auto_complete :name %>
I just don't know how to link up my text box with Sphinx. Do I need to create a button? Thanks for any help.
Upvotes: 0
Views: 1998
Reputation: 115292
Ryan Bates has a Railscast on Thinking Sphinx that should set you in the right direction. You can view the source code for the form in Ryan's example:
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
</p>
Upvotes: 4