Search Results
<%
search_regexp = /#{query['regex'].strip}/i
title_results = @wiki.select { |name,apage| name=~ search_regexp }
text_results = @wiki.select { |name,apage| apage.content=~ search_regexp }
%>
Results of Search for “<%= query['regex'] %>”
<% unless title_results.empty? %>
Matches in the titles of pages
<% title_results.each do |name, page| %>
- <%= name %>
<% end %>
<% else %>
No matches in the titles of pages
<% end %>
<% unless text_results.empty? %>
Matches in the text of pages
<% text_results.each do |name, page| %>
- <%= name %>
<% end %>
<% else %>
No matches in the text of pages
<% end %>