FIX: search server side error in rare condition
This commit is contained in:
parent
0b55416742
commit
e501936405
|
@ -374,6 +374,8 @@ class Search
|
|||
exact = true
|
||||
|
||||
slug = match.to_s.split(":")
|
||||
next if slug.empty?
|
||||
|
||||
if slug[1]
|
||||
# sub category
|
||||
parent_category_id = Category.where(slug: slug[0].downcase, parent_category_id: nil).pluck(:id).first
|
||||
|
|
|
@ -837,6 +837,9 @@ describe Search do
|
|||
|
||||
results = Search.new('#777').execute
|
||||
expect(results.posts.length).to eq(0)
|
||||
|
||||
results = Search.new('xxx #:').execute
|
||||
expect(results.posts.length).to eq(0)
|
||||
end
|
||||
|
||||
context 'tags' do
|
||||
|
|
Loading…
Reference in New Issue