jina.types.document.uid

Remarks on the id, we have three views for it

  • id: str is a hex string, for non-binary environment such as HTTP, CLI, HTML and also human-readable. it will be used as the major view.

  • bytes: bytes is the binary format of str, it has 8 bytes fixed length, so it can be used in the dense file storage, e.g. BinaryPbIndexer, as it requires the key has to be fixed length.

  • int:int64 (formerly names hash) is the integer form of bytes, as 8 bytes map to int64 . This is useful when sometimes you want to use key along with other numeric values together in one ndarray, such as ranker and Numpyindexer

jina.types.document.uid.int2bytes(value)[source]
Return type

bytes

jina.types.document.uid.bytes2int(value)[source]
Return type

int

jina.types.document.uid.id2bytes(value)[source]
Return type

bytes

jina.types.document.uid.bytes2id(value)[source]
Return type

str

jina.types.document.uid.int2id(value)[source]
Return type

str

jina.types.document.uid.id2hash(value)[source]
Return type

int

jina.types.document.uid.id2int(value)[source]
Return type

int

jina.types.document.uid.is_valid_id(value)[source]
Return type

bool

class jina.types.document.uid.UniqueId[source]

Bases: str