Method: Tokite::SearchQuery.validate

Defined in:
app/models/tokite/search_query.rb

.validate(query) ⇒ Object



47
48
49
50
51
52
53
54
# File 'app/models/tokite/search_query.rb', line 47

def self.validate(query)
  tree = SearchQuery.parse(query)
  tree.each do |word|
    Regexp.compile(word[:regexp_word].to_s, Regexp::IGNORECASE) if word[:regexp_word]
  end
rescue RegexpError => e
  raise QueryRegexpError, e
end