Yeah, kudos for writing it, it's always good to write something like that and learn.  If you find further needs, I'd really recommend looking at the "thin wrapper around lucene" approach, they've been banging on this problem for a decade and have a lot of lessons learned in their codebase.