fixed search error

This commit is contained in:
zmagod 2016-08-02 11:10:30 +02:00
parent 95da62adde
commit 166f907780

View file

@ -55,15 +55,18 @@ class SearchController < ApplicationController
flash[:error] = t'search.index.error.query_length', n: MIN_QUERY_CHARS
redirect_to :back
else
@splited_query.each_with_index do |w, i|
if @splited_query.length > 1 && w.length < MIN_QUERY_CHARS
@splited_query.slice!(i)
if @splited_query.length > 1
@search_query = ''
@splited_query.each_with_index do |w, i|
if w.length >= MIN_QUERY_CHARS
@search_query += "#{@splited_query[i]} "
end
end
else
@search_query = @splited_query.join(' ')
end
end
@search_query = @splited_query.join(' ')
if @search_page < 1
@search_page = 1
end