entity_doc
entity_doc (entity[, doc])
This function returns the document identifier of the text or file entity specified by entity (for the specified doc or the current document if doc is not specified). entity_doc returns -1 if entity is not a file or text entity. If entity is a file entity reference, the document identifier returned will be different from the specified doc. If entity is a text entity, the document identifier returned will be doc.