Al momento, un ID cliente può supportare una sola funzionalità di ricerca. Se vuoi utilizzare più funzionalità di ricerca nella tua app, devi utilizzare più ID client. Inoltre, se vuoi utilizzare la stessa funzionalità dei risultati di ricerca in diversi punti di accesso della tua app, devi utilizzare anche ID client diversi per ciascuno di essi per distinguere il traffico.
Per ogni richiesta, puoi impostare in modo proattivo un ID client in
GetSearchSuggestionsOptions, GetTrendingSearchesOptions o
GetSearchContentOptions e questo ID sostituirà l'ID client predefinito
nel file Info.plist (solo per questa richiesta).
Swift
getSearchSuggestions(withOptions:)
Task {
let options = GetSearchSuggestionsOptions(withTextContext:['Sample Query', 'Another query string'])
options.clientId = "client id"
let suggestions = try await searchRuntime.getSearchSuggestions(
withOptions: options)
}
Objective-C
getSearchSuggestionsWithOptions
GetSearchSuggestionsOptions *options = [[GetSearchSuggestionsOptions alloc] initWithTextContext: @[@'Sample Query', @'Another query string' ]];
options.clientId = [NSString stringWithFormat:@"client id"];
[searchRuntime
getSearchSuggestionsWithOptions:options
completionHandler:^(SearchSuggestions *_Nullable suggestions,
NSError *_Nullable error) {
// error will be not null if there is an error.
// On success, suggestions will be non null.
}];