fix - uniqueness criteria for *_documents

It was possible to have repetitive topic_documents. Fixed it.