Algolia searching encrypted data

189 Views Asked by At

Currently, my database has encrypted data which I send to Algolia. I need to search on this encrypted data but if indexed is 'John' and I search 'Joh', they are not similar at all, and thus result to 0 hits.

Any ideas how to solve this? I am currently running rails and attr_encrypted

1

There are 1 best solutions below

0
On

I don't think this is possible. Search indexes like Algolia operate on raw text - they tokenize words and phrases and create a reverse index from them. If you send Algolia an encrypted string, it won't be able to identify words (because there won't be any spaces).

The only way to make this work is to send Algolia your decrypted attribute contents.