Searching a multiplexed database column
Multiplexing columns is an optimization used in some database schema. The idea is to store multiple integers or boolean values in a single integer column. The read and write operations are done using bit wise operators. For example we can store several flags in a single integer column, the first flag value is 1, the second 2, the third value is 4, etc.
Scoped search is able to expose multiplexed filed by specifying the offset and word size. In the common case of multiplexing booleans, the word size is 1.
scoped_search :on => :counters, :offset => 0 , :word_size => 6, :rename => :applied scoped_search :on => :counters, :offset => 1 , :word_size => 6, :rename => :skipped
The search syntax will expose the multiplexed column as multiple columns.
Leave a Comment