so after reviewing this and trying to understand what it does I think I got it. But I am not sure if this is really the way to go. I rather think we should do this in a kind of a map&reduce process based on the context document. At this point we are using Document as the abstraction but we can just use our own that allows to group fields by key or anything like that which allows us to just preprocess the document and each mapper can just put the values in the document directly instead of going the indirection of the context cache? one way of implementing this would be a dedicated field that we can append on that then returns a byte value? 

really I am just thinking out loud  here :)