# EnterpriseGlobalSearchSession

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

*** ** * ** ***


```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.ENTERPRISE_GLOBAL_SEARCH_SESSION)
interface EnterpriseGlobalSearchSession : ReadOnlyGlobalSearchSession
```

<br />

*** ** * ** ***

Provides a connection to all enterprise (work profile) AppSearch databases the querying application has been granted access to.

This session can be created from any user profile but will only properly return results when created from the main profile. If the user is not the main profile or an associated work profile does not exist, queries will still successfully complete but with empty results.

Schemas must be explicitly tagged enterprise and may require additional permissions to be visible from an enterprise session. Retrieved documents may also have certain fields restricted or modified unlike if they were retrieved directly from `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GlobalSearchSession` on the work profile.

All implementations of this interface must be thread safe.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GlobalSearchSession` |   |

## Summary

### Inherited functions

From [androidx.appsearch.app.ReadOnlyGlobalSearchSession](https://developer.android.com/reference/kotlin/androidx/appsearch/app/ReadOnlyGlobalSearchSession) `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBatchResult<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument!>!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/kotlin/androidx/appsearch/app/Features.GLOBAL_SEARCH_SESSION_GET_BY_ID)
https://developer.android.com/reference/kotlin/androidx/appsearch/app/ReadOnlyGlobalSearchSession#getByDocumentIdAsync(java.lang.String,java.lang.String,androidx.appsearch.app.GetByDocumentIdRequest)(
packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html,
databaseName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html,
request: https://developer.android.com/reference/kotlin/androidx/appsearch/app/GetByDocumentIdRequest
)`

Retrieves `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` documents, belonging to the specified package name and database name and identified by the namespace and ids in the request, from the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GlobalSearchSession` database.
`https://developer.android.com/reference/kotlin/androidx/appsearch/app/Features` `https://developer.android.com/reference/kotlin/androidx/appsearch/app/ReadOnlyGlobalSearchSession#getFeatures()()`

Returns the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/Features` to check for the availability of certain features for this session.
`https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/GetSchemaResponse!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/kotlin/androidx/appsearch/app/Features.GLOBAL_SEARCH_SESSION_GET_SCHEMA)
https://developer.android.com/reference/kotlin/androidx/appsearch/app/ReadOnlyGlobalSearchSession#getSchemaAsync(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)`

Retrieves the collection of schemas most recently successfully provided to `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` for any types belonging to the requested package and database that the caller has been granted access to.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/kotlin/androidx/appsearch/app/Features.GLOBAL_SEARCH_SESSION_REGISTER_OBSERVER_CALLBACK)
https://developer.android.com/reference/kotlin/androidx/appsearch/app/ReadOnlyGlobalSearchSession#registerObserverCallback(java.lang.String,androidx.appsearch.observer.ObserverSpec,java.util.concurrent.Executor,androidx.appsearch.observer.ObserverCallback)(
targetPackageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html,
spec: https://developer.android.com/reference/kotlin/androidx/appsearch/observer/ObserverSpec,
executor: https://developer.android.com/reference/java/util/concurrent/Executor.html,
observer: https://developer.android.com/reference/kotlin/androidx/appsearch/observer/ObserverCallback
)`

Adds an `https://developer.android.com/reference/kotlin/androidx/appsearch/observer/ObserverCallback` to monitor changes within the databases owned by `targetPackageName` if they match the given `https://developer.android.com/reference/kotlin/androidx/appsearch/observer/ObserverSpec`.
`https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchResults` `https://developer.android.com/reference/kotlin/androidx/appsearch/app/ReadOnlyGlobalSearchSession#search(java.lang.String,androidx.appsearch.app.SearchSpec)(queryExpression: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, searchSpec: https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchSpec)`

Retrieves documents from all AppSearch databases that the querying application has access to.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/kotlin/androidx/appsearch/app/Features.GLOBAL_SEARCH_SESSION_REGISTER_OBSERVER_CALLBACK)
https://developer.android.com/reference/kotlin/androidx/appsearch/app/ReadOnlyGlobalSearchSession#unregisterObserverCallback(java.lang.String,androidx.appsearch.observer.ObserverCallback)(
targetPackageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html,
observer: https://developer.android.com/reference/kotlin/androidx/appsearch/observer/ObserverCallback
)`

Removes previously registered `https://developer.android.com/reference/kotlin/androidx/appsearch/observer/ObserverCallback` instances from the system.