fix docIndex and docId filtering for document terms