फ़िलहाल, एक क्लाइंट आईडी में सिर्फ़ एक सर्च सुविधा काम कर सकती है. अगर आपको अपने ऐप्लिकेशन में खोज की कई सुविधाओं का इस्तेमाल करना है, तो आपको कई क्लाइंट आईडी का इस्तेमाल करना चाहिए. इसके अलावा, अगर आपको अपने ऐप्लिकेशन के अलग-अलग एंट्री पॉइंट में एक ही खोज सुविधा का इस्तेमाल करना है, तो आपको ट्रैफ़िक में अंतर करने के लिए, हर एंट्री पॉइंट के लिए अलग-अलग क्लाइंट आईडी का इस्तेमाल करना चाहिए.
अपने हर अनुरोध के लिए, GetSearchSuggestionsOptions
, GetTrendingSearchesOptions
या GetSearchContentOptions
में क्लाइंट आईडी सेट किया जा सकता है. यह आईडी, Info.plist
फ़ाइल में डिफ़ॉल्ट क्लाइंट आईडी को बदल देगा (सिर्फ़ इस अनुरोध के लिए).
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.
}];