wiki pages: fix redirects to exact matches during search.

Change wiki page search to redirect to exact matches only when using the
quick search bar. Fixes searches sometimes unexpectedly redirecting when
doing a regular (non-quick) search that happens to return a single result.

Also remove the logic that tries to expand the search when no results
are found. This will eventually be replaced with a smarter "did you mean?"
search.
This commit is contained in:
evazion
2019-10-31 02:08:51 -05:00
parent 91fd5e1bff
commit a8fc2ba508
4 changed files with 12 additions and 14 deletions

View File

@@ -164,7 +164,8 @@ module ApplicationHelper
def quick_search_form_for(attribute, url, name, autocomplete: nil, &block)
tag.li do
search_form_for(url, classes: "quick-search-form one-line-form") do |f|
f.input attribute, label: false, placeholder: "Search #{name}", input_html: { id: nil, "data-autocomplete": autocomplete }
out = tag.input type: :hidden, name: :redirect, value: "1"
out += f.input attribute, label: false, placeholder: "Search #{name}", input_html: { id: nil, "data-autocomplete": autocomplete }
end
end
end