<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/CSUserQueryContext",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Spotlight"
    ],
    "preciseIdentifier" : "c:objc(cs)CSUserQueryContext"
  },
  "title" : "CSUserQueryContext"
}
-->

# CSUserQueryContext

The configuration details to apply to a user query.

```
class CSUserQueryContext
```

## Overview

Use an instance of `CSUserQueryContext` to configure the search
parameters for a [`CSUserQuery`](/documentation/CoreSpotlight/CSUserQuery) object. This object stores
configuration details that the query uses to modify the search
results it delivers. For example, use this object to specify the
maximum number of results or suggestions you want the query to
return. You can also use it to enable or disable the ranking of
results by Spotlight.

For information about search filters and other configurable query
parameters, see the parent class [`CSSearchQueryContext`](/documentation/CoreSpotlight/CSSearchQueryContext).

## Topics

### Creating a query context

[`+  userQueryContextWithCurrentSuggestion:`](/documentation/CoreSpotlight/CSUserQueryContext/init(currentSuggestion:))

Creates a new query context object with an optional suggested search string.

### Configuring search options

[`maxResultCount`](/documentation/CoreSpotlight/CSUserQueryContext/maxResultCount)

The maximum number of search results for the query to return.

[`maxSuggestionCount`](/documentation/CoreSpotlight/CSUserQueryContext/maxSuggestionCount)

The maximum number of suggested text completions for the query to return.

[`disableSemanticSearch`](/documentation/CoreSpotlight/CSUserQueryContext/disableSemanticSearch)

A Boolean value that indicates whether to exclude semantic-based
search results from the output.

### Configuring the ranked results behavior

[`enableRankedResults`](/documentation/CoreSpotlight/CSUserQueryContext/enableRankedResults)

A Boolean value that indicates whether the query sorts results
by their relevance.

[`maxRankedResultCount`](/documentation/CoreSpotlight/CSUserQueryContext/maxRankedResultCount)

The maximum number of ranked results to return during the query.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`CSSearchQueryContext`](/documentation/CoreSpotlight/CSSearchQueryContext)

---

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)