@question = params[:q] || ""\r
@question.strip!\r
@all_words = params[:all_words] || (params[:submit] ? false : true)\r
- @scope = params[:scope] || (params[:submit] ? [] : %w(issues news documents) )\r
+ @scope = params[:scope] || (params[:submit] ? [] : %w(issues news documents wiki) )\r
if !@question.empty?\r
# tokens must be at least 3 character long\r
@tokens = @question.split.uniq.select {|w| w.length > 2 }\r
@results += @project.issues.find(:all, :limit => limit, :include => :author, :conditions => [ (["(LOWER(issues.subject) like ? OR LOWER(issues.description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'issues'\r
@results += @project.news.find(:all, :limit => limit, :conditions => [ (["(LOWER(news.title) like ? OR LOWER(news.description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort], :include => :author ) if @scope.include? 'news'\r
@results += @project.documents.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'documents'\r
+ @results += @project.wiki.pages.find(:all, :limit => limit, :include => :content, :conditions => [ (["(LOWER(wiki_pages.title) like ? OR LOWER(wiki_contents.text) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @project.wiki && @scope.include?('wiki')\r
@question = @tokens.join(" ")\r
end\r
end\r
<p><%= text_field_tag 'q', @question, :size => 30 %>\r
<%= check_box_tag 'scope[]', 'issues', (@scope.include? 'issues') %> <label><%= l(:label_issue_plural) %></label>\r
<%= check_box_tag 'scope[]', 'news', (@scope.include? 'news') %> <label><%= l(:label_news_plural) %></label>\r
-<%= check_box_tag 'scope[]', 'documents', (@scope.include? 'documents') %> <label><%= l(:label_document_plural) %></label><br />\r
+<%= check_box_tag 'scope[]', 'documents', (@scope.include? 'documents') %> <label><%= l(:label_document_plural) %></label>\r
+<% if @project.wiki %>\r
+<%= check_box_tag 'scope[]', 'wiki', (@scope.include? 'wiki') %> <label><%= l(:label_wiki) %></label>\r
+<% end %>\r
+<br />\r
<%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></p>\r
<%= submit_tag l(:button_submit), :name => 'submit' %>\r
<% end %>\r
<%=l(:label_document)%>: <%= link_to highlight_tokens(h(e.title), @tokens), :controller => 'documents', :action => 'show', :id => e %><br />\r
<%= highlight_tokens(e.description, @tokens) %><br />\r
<i><%= format_time(e.created_on) %></i>\r
+ <% elsif e.is_a? WikiPage %>\r
+ <%=l(:label_wiki)%>: <%= link_to highlight_tokens(h(e.pretty_title), @tokens), :controller => 'wiki', :action => 'index', :id => @project, :page => e.title %><br />\r
+ <%= highlight_tokens(e.content.text, @tokens) %><br />\r
+ <i><%= e.content.author ? e.content.author.name : "Anonymous" %>, <%= format_time(e.content.updated_on) %></i>\r
<% end %>\r
</p></li> \r
<% end %>\r