The PostgreSQLAdapter make sure that
searches are case sensitive when using the like/unlike operators, by using
the PostrgeSQL-specific ILIKE operator
instead of
LIKE
.
Switches out the default LIKE operator for ILIKE in the default
sql_operator
method.
# File lib/scoped_search/query_builder.rb, line 466 def sql_operator(operator, field) raise ScopedSearch::QueryNotSupported, "the operator '#{operator}' is not supported for field type '#{field.type}'" if [:like, :unlike].include?(operator) and !field.textual? case operator when :like then 'ILIKE' when :unlike then 'NOT ILIKE' else super(operator, field) end end
Returns a NOT (…) SQL fragment that negates the current AST node’s children
# File lib/scoped_search/query_builder.rb, line 476 def to_not_sql(rhs, definition, &block) "NOT COALESCE(#{rhs.to_sql(self, definition, &block)}, false)" end