> 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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---