Skip to content

Business intelligence made simple

Added support for blind indexing - closes #216

Andrew Kaneaaabfbcde308
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 09a56532..6ef2988c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.0.2 [unreleased]
+
+- Added support for variable transformation for blind indexing
+
## 2.0.1
- Added favicon
diff --git a/README.md b/README.md
index 923f5993..b12504ea 100644
--- a/README.md
+++ b/README.md
@@ -175,6 +175,19 @@ Also, make sure authorization is enabled when you start the server.
If your database contains sensitive or personal data, check out [Hypershield](https://github.com/ankane/hypershield) to shield it.
+## Encrypted Data
+
+If you need to search encrypted data, use [blind indexing](https://github.com/ankane/blind_index).
+
+You can have Blazer transform specific variables with: [master]
+
+```ruby
+Blazer.transform_variable = lambda do |name, value|
+ value = User.compute_email_bidx(value) if name == "email_bidx"
+ value
+end
+```
+
## Queries
### Variables
diff --git a/app/controllers/blazer/base_controller.rb b/app/controllers/blazer/base_controller.rb
index fa98a748..751d605a 100644
--- a/app/controllers/blazer/base_controller.rb
+++ b/app/controllers/blazer/base_controller.rb
@@ -63,6 +63,7 @@ module Blazer
value = value.to_f
end
end
+ value = Blazer.transform_variable.call(var, value) if Blazer.transform_variable
statement.gsub!("{#{var}}", ActiveRecord::Base.connection.quote(value))
end
end
diff --git a/lib/blazer.rb b/lib/blazer.rb
index bb9e629f..159faf3e 100644
--- a/lib/blazer.rb
+++ b/lib/blazer.rb
@@ -40,6 +40,7 @@ module Blazer
attr_accessor :from_email
attr_accessor :cache
attr_accessor :transform_statement
+ attr_accessor :transform_variable
attr_accessor :check_schedules
attr_accessor :anomaly_checks
attr_accessor :forecasting