ankane/blind_index

Backfill is broken or am I defining my columns wrong?

Linuus opened this issue · 3 comments

Hi!

I've added a new column and want to backfill it. I tried using the BlindIndex.backfill method but it fails with Bad column: my_column_bidx.

I added a debugger in the filter_columns! method and in there we first convert all columns to strings. But, then when we fetch the :bidx_attribute it's actually a symbol so it doesn match.

Why are we converting the columns to strings first?

My columns are added like this:

  blind_index(:column, bidx_attribute: :encrypted_column_bidx)
  blind_index(:column_ci, attribute: :token, bidx_attribute: :encrypted_column_ci_bidx, expression: ->(v) { v.downcase })

Is this wrong? Do I need to specify the bidx_attribute: as a string? bidx_attribute: "encrypted_column_bidx"?
If yes, is this documented somewhere? :)

Edit:

I saw now that there is one example in the docs where bidx_attribute is used and indeed set to a string so I guess that's my issue.
Perhaps we can make it clearer somewhere so the next person doesn't make the same mistake as me? :)

Hey @Linuus, thanks for reporting. Fixed in the commit above.

Hey @Linuus, thanks for reporting. Fixed in the commit above.

Thanks! That was quick! :)

So, it should be ok to define the columns as either strings or symbols then?

Yes, either should work.