Hello, if anyone can help implement/develop a site’s SEARCH feature
please reply. Thanks.
Why don’t you use Google or Yahoo!'s site search feature? It is as
simple as plugging in a javascript.
Hello, if anyone can help implement/develop a site’s SEARCH feature
please reply. Thanks.
Mean something like fulltext search on your database content?
I would use sphinx for that.
Together with ultrasphinx that would take just a few lines of code
(ok, a few more to get the config files right)
that would be all you need in the model:
is_indexed :fields => [:title, :text, :updated_at, :created_at],
:conditions => “draft = 0”,
:delta => {:field => “updated_at”}
this would be the controller:
def show
@search = Ultrasphinx::Search.new(:query => params[:keywords],
:page => 1,
:per_page => 50,
:class_name => “pages”,
:sort_mode => “relevance”)
@results = @search.excerpt
end
the searchbox for the view:
<% form_tag(search_path, :method => :get) do %>
<input type="submit" class="submit" value="zoek" /><input
name=“keywords” class=“keywords” value=<%= params[:keywords] %> />
<% end %>
ok, there would be lots(!) of further options and features,
what to index, when to index and so on, but this is a working
example i took from one of our sites.