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 454
454:       def sql_operator(operator, field)
455:         raise ScopedSearch::QueryNotSupported, "the operator '#{operator}' is not supported for field type '#{field.type}'" if [:like, :unlike].include?(operator) and !field.textual?
456:         case operator
457:           when :like   then 'ILIKE'
458:           when :unlike then 'NOT ILIKE'
459:           else super(operator, field)
460:         end
461:       end

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

[Source]

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

[Validate]