Permalink
Browse files

Made search results and autocomplete only come from "current" versions.

  • Loading branch information...
1 parent a6d4aa0 commit 5477bdc09698a3d852bfc8a8937e59fb375a2cef @zk committed Sep 26, 2011
Showing with 11 additions and 1 deletion.
  1. +11 −1 app/controllers/main_controller.rb
@@ -122,10 +122,16 @@ def search
@functions = Function.search(q, :page => params[:page], :per_page => 16, :match_mode => :extended, :field_weights => {:name => 10,:doc => 1})
+
+
@functions = @functions[0..24]
end
+ @functions = @functions.find_all { |f|
+ f.library.current
+ }
+
if params[:feeling_lucky] and @functions.size > 0
func = @functions[0]
redirect_to "/#{func.library}/#{func.ns}/#{CGI::escape(func.name)}"
@@ -330,7 +336,11 @@ def search_autocomplete
if @exact_matches
@functions = (@exact_matches + @functions).uniq
end
-
+
+ @functions = @functions.find_all { |f|
+ f.library.current
+ }
+
if @functions.size > 10
@functions = @functions[0, 10]
end

0 comments on commit 5477bdc

Please sign in to comment.