Class ScopedSearch::QueryBuilder::PostgreSQLAdapter
In: lib/scoped_search/query_builder.rb
Parent: ScopedSearch::QueryBuilder

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.

Methods

Public Instance methods

Switches out the default LIKE operator for ILIKE in the default sql_operator method.

[Source]

     # File lib/scoped_search/query_builder.rb, line 466
466:       def sql_operator(operator, field)
467:         raise ScopedSearch::QueryNotSupported, "the operator '#{operator}' is not supported for field type '#{field.type}'" if [:like, :unlike].include?(operator) and !field.textual?
468:         case operator
469:           when :like   then 'ILIKE'
470:           when :unlike then 'NOT ILIKE'
471:           else super(operator, field)
472:         end
473:       end

Returns a NOT (…) SQL fragment that negates the current AST node‘s children

[Source]

     # File lib/scoped_search/query_builder.rb, line 476
476:       def to_not_sql(rhs, definition, &block)
477:         "NOT COALESCE(#{rhs.to_sql(self, definition, &block)}, false)"
478:       end

[Validate]