Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Tìm kiếm thịnh hành
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Xem nội dung thịnh hành
Để xem nội dung tìm kiếm thịnh hành, hãy gọi phương thức getTrendingSearches trên ContextualSearchRuntime. Phương thức này lấy một GetTrendingSearchesOptions duy nhất, trong đó bạn có thể chỉ định số lượng nội dung thịnh hành tối đa được trả về.
Đối tượng SearchSuggestions được trả về không chứa bất kỳ thuộc tính nào có thể truy cập. Tệp này chứa tất cả thông tin cần thiết để hiển thị nội dung tìm kiếm thịnh hành, nhưng không rõ ràng.
Swift sử dụng kiểu Swift Concurrency, Objective-C sử dụng hàm callback.
Objective-C
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.
}];
Màn hình
Để hiển thị khối nội dung tìm kiếm thịnh hành, hãy sử dụng cách tương tự như cụm từ tìm kiếm được đề xuất.
Tiếp theo: Hiển thị kết quả tìm kiếmarrow_forward
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[],["To retrieve trending searches, use the `getTrendingSearches` method of `ContextualSearchRuntime`, providing `GetTrendingSearchesOptions` to set the maximum results. Swift employs async/await, while Objective-C utilizes a completion handler. The `SearchSuggestions` object returned is opaque, solely intended for rendering. Display trending search chips similarly to search suggestions using the method described in another page. Both languages provide the necessary tools to retrieve and handle trending search data.\n"]]