I'm try to create GIN for fast similarity search on bitsrings on postgres 9.6.
I use tanimoto/jaccard similarity metric:
tanimoto = popcount(bs1 & bs2)/popcount(bs1 | bs2)
where 0 - is totally not similar and 1 - is identical.
update:
popcount - is count of true bits. bs1, bs2 - bitstrings.
I use query like this:
SELECT bs, tanimoto(B'11100000', bs) as t FROM test WHERE bs % B'11100000'
on table:
CREATE TABLE test (bs bit(8));
% operator is bool(tanimoto(bs, B'11100000') > treshold)
treshold configurable.
How can I enable GIN or how to implement operator_class if need?
I want to implement this http://pubs.acs.org/doi/abs/10.1021/ci200552r index