現在、1 つのクライアント ID でサポートできる検索結果の機能は 1 つのみです。アプリで複数の検索機能を使用する場合は、複数のクライアント ID を使用する必要があります。また、アプリの異なるエントリ ポイントで同じ検索結果の機能を使用する場合は、トラフィックを区別するために、それぞれに異なるクライアント ID を使用する必要があります。
リクエストごとに、GetSearchSuggestionsOptions、GetTrendingSearchesOptions、GetSearchContentOptions でクライアント ID を事前に設定できます。この ID は、Info.plist ファイルのデフォルトのクライアント ID をオーバーライドします(このリクエストのみ)。
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.
}];