Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Simplify Search::PageSearcher#search
Browse files Browse the repository at this point in the history
Remove #validate_query as it's unnecessary. validate_query checks
that query is not black, so we can make the same inline check.
  • Loading branch information
Vincent Martinez committed Mar 1, 2017
1 parent a135db5 commit 762bc5b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions app/services/search/page_searcher.rb
Expand Up @@ -7,7 +7,7 @@ def initialize(params)

def search
[*@queries].each do |search_type, query|
if !validate_query(query)
if query.blank?
next
else
case search_type.to_s
Expand Down Expand Up @@ -35,11 +35,6 @@ def search

private

def validate_query(query)
# if query is an empty array, nil or an empty string, skip filtering for that query
[[], nil, ''].include? query ? false : true
end

def combine_collections(collection1, collection2)
# get union of unique values in collection1 and collection2
arr = (collection1 | collection2).uniq
Expand Down

0 comments on commit 762bc5b

Please sign in to comment.