ibsusu · GitHub

大北

Allow users to filter stories that match specific tag combinations
(e.g. hide stories tagged both "javascript" AND "culture" while still
seeing stories with either tag alone). Up to 15 combinations per user,
each with 2 to 15 tags.
Uses a two-phase bloom filter approach: a 64-bit bitmask on stories
(tag_hash) for fast bitwise rejection, followed by SQL verification
to handle false positives. Benchmark shows ~3.5% overhead vs
traditional single tag filters.
Single migration, clean rollback. Scope rescues if tables are missing,
callbacks guard on column existence. No caching behavior changes for
logged in users.
Production code: 427 lines across 9 files
Tests: 503 lines (story, model, controller, integration)
Benchmark: 183 lines

Read the original on github.com ↗