ট্রেন্ডিংগুলো জানুন
ট্রেন্ডিং সার্চগুলো পেতে, ContextualSearchRuntime এ getTrendingSearches মেথডটি কল করুন। এই মেথডটি একটিমাত্র GetTrendingSearchesOptions গ্রহণ করে, যেখানে আপনি ফেরত আসা ট্রেন্ডিংয়ের সর্বোচ্চ সংখ্যা নির্দিষ্ট করে দিতে পারেন।
ফেরত আসা SearchSuggestions অবজেক্টটিতে কোনো অ্যাক্সেসযোগ্য প্রোপার্টি থাকে না। এতে ট্রেন্ডিং সার্চগুলো দেখানোর জন্য প্রয়োজনীয় সমস্ত তথ্য থাকে, কিন্তু এছাড়া এটি অস্বচ্ছ।
সুইফট সুইফট কনকারেন্সি স্টাইল ব্যবহার করে, অবজেক্টিভ-সি একটি কলব্যাক ফাংশন ব্যবহার করে।
সুইফট
getTrendingSearches(withOptions:)
Task {
let suggestions = try await searchRuntime.getTrendingSearches(
withOptions: GetTrendingSearchesOptions())
}
উদ্দেশ্য-সি
getTrendingSearchesWithOptions
[searchRuntime
getTrendingSearchesWithOptions:
[[GetTrendingSearchesOptions alloc] init]
completionHandler:^(SearchSuggestions *_Nullable suggestions,
NSError *_Nullable error) {
// error will be not null if there is an error.
// On success, suggestions will be non null.
}];
প্রদর্শন
ট্রেন্ডিং সার্চ চিপস প্রদর্শন করতে, সার্চ সাজেশনের মতোই একই পদ্ধতি ব্যবহার করুন।