lib/index.cc: generalize filter state machine