filter by doc_type and domain before wrapping

http://manage.dimagi.com/default.asp?114044#643689

depends on https://github.com/dimagi/fluff/pull/83

@lrozanski