ankane/blind_index

LIKE / ILIKE not supported

portwood opened this issue · 1 comments

Is there a way to perform wildcard queries, for example, PostgreSQL LIKE queries, on fields using blind_index?
I've tried several approaches without luck.
For example:
Person.where(first_name: 'Michael') and Person.where('first_name = "Michael") work properly.
Person.where('first_name LIKE "%M%") and Person.where('first_name LIKE ?', "%M%") produce the following error: ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR: column "first_name" does not exist)
(The field, first_name, is properly configured to use blind index)

Hey @portwood, traditional LIKE queries aren't possible with blind indexing. The closest you can do is expression indexes. I'd recommend reading this link from the readme so you understand how it works on a high level.