Talking about query serialization. There is LUCENE-5000. Maybe we can use some of its code. Shame it has not made it yet into Lucene