# DocumentIdUtil

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/util/DocumentIdUtil.java+class:androidx.appsearch.util.DocumentIdUtil) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
class DocumentIdUtil
```

<br />

*** ** * ** ***

A util class with methods for working with document ids.

## Summary

| ### Public functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/util/DocumentIdUtil#createQualifiedId(java.lang.String,java.lang.String,androidx.appsearch.app.GenericDocument)( packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, databaseName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, document: https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument )` Generates a qualified id based on package, database, and a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/util/DocumentIdUtil#createQualifiedId(java.lang.String,java.lang.String,java.lang.String,java.lang.String)( packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, databaseName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html )` Generates a qualified id based on package, database, namespace, and doc id. |

## Public functions

### createQualifiedId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
java-static fun createQualifiedId(
    packageName: String,
    databaseName: String,
    document: GenericDocument
): String
```

Generates a qualified id based on package, database, and a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`.

| Parameters |
|---|---|
| `packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The package the document belongs to. |
| `databaseName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The database containing the document. |
| `document: https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` | The document to generate a qualified id for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the qualified id of a document. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/util/DocumentIdUtil#createQualifiedId(java.lang.String,java.lang.String,java.lang.String,java.lang.String)` |   |

### createQualifiedId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
java-static fun createQualifiedId(
    packageName: String,
    databaseName: String,
    namespace: String,
    id: String
): String
```

Generates a qualified id based on package, database, namespace, and doc id.

A qualified id is a String referring to the combined package name, database name, namespace, and id of the document. It is useful for linking one document to another in order to perform a join operation with `https://developer.android.com/reference/kotlin/androidx/appsearch/app/JoinSpec`.

| Parameters |
|---|---|
| `packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The package the document belongs to. |
| `databaseName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The database containing the document. |
| `namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The namespace of the document. |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The id of the document. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the qualified id of a document |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/JoinSpec` |   |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/JoinSpec#QUALIFIED_ID()` |   |