<!--
{
  "documentType" : "article",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/entity-queries",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Entity queries"
}
-->

# Entity queries

Implement one or more query types to help the system find your app’s entities.

## Overview

When the system needs to retrieve one or more specific instances of an app
entity, it asks you to provide a relevant query type. The system uses queries
during parameter resolution when the parameter of an intent contains
an entity. The system also uses them to resolve information in a different
format into one of your app’s entities. For example, it uses them to
resolve natural spoken language into one of your app’s entities.

The system can sometimes determine which entities it needs and provide you
with a list of corresponding identifiers. Provide an [`EntityQuery`](/documentation/AppIntents/EntityQuery) type
to supply the entities for those identifiers. Provide additional query
types to perform more advanced searches, such as a search that matches
specific properties of the entity.

## Topics

### Identifier-based queries

[`EntityQuery`](/documentation/AppIntents/EntityQuery)

An interface for locating app entity instances by identifier.

[`IndexedEntityQuery`](/documentation/AppIntents/IndexedEntityQuery)

An interface that adds Spotlight reindexing support to your entity query.

[`EnumerableEntityQuery`](/documentation/AppIntents/EnumerableEntityQuery)

An interface you use to provide a short list of entities that are relatively small in size.

### String-based queries

[`EntityStringQuery`](/documentation/AppIntents/EntityStringQuery)

An interface that locates entities using arbitrary string input.

### Property-matched queries

[`EntityPropertyQuery`](/documentation/AppIntents/EntityPropertyQuery)

An interface for locating entities by matching values against one or more of their properties.

[`EntityQueryProperties`](/documentation/AppIntents/EntityQueryProperties)

A type that provides the properties to include in a property-matched query.

[`EntityQueryProperty`](/documentation/AppIntents/EntityQueryProperty)

An object that provides the supported comparators you use to describe the different ways users can query against a property
of an app entity.

[Property comparators](/documentation/AppIntents/property-comparators)

Specify the type of comparison to perform during a property-matched query.

### Sort options

[`EntityQuerySortingOptions`](/documentation/AppIntents/EntityQuerySortingOptions)

The potential properties you can use to sort the results of a query.

[`EntityQuerySortableByProperty`](/documentation/AppIntents/EntityQuerySortableByProperty)

Details about a specific property you use to sort the query results.

[`EntityQuerySort`](/documentation/AppIntents/EntityQuerySort)

The properties to use to sort the results when the query runs.

### Unique entity queries

[`UniqueAppEntityQuery`](/documentation/AppIntents/UniqueAppEntityQuery)

A query designed for only returning a single possible value, provided by `uniqueEntity`.
Protocol extensions will provide the other required query methods based on that.

[`UniqueAppEntityProvider`](/documentation/AppIntents/UniqueAppEntityProvider)

A simplified query type conforming to `UniqueAppEntityQuery`.  Use this as the value
of the `defaultQuery` of an entity conforming to `UniqueAppEntity`.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)