Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Wyszukiwania zyskujące popularność
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Pobieranie trendów
Aby pobrać wyszukiwania zyskujące popularność, wywołaj metodę getTrendingSearches w ContextualSearchRuntime. Ta metoda przyjmuje pojedynczy
GetTrendingSearchesOptions
, w którym możesz określić maksymalną liczbę zwracanych trendów.
Zwrócony obiekt SearchSuggestions nie zawiera żadnych dostępnych właściwości. Zawiera wszystkie informacje potrzebne do renderowania wyszukiwań zyskujących popularność, ale poza tym jest nieprzezroczysty.
Swift używa stylu Swift Concurrency, a Objective-C – funkcji wywołania zwrotnego.
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.
}];
Wyświetlacz
Aby wyświetlić chipy wyszukiwań zyskujących popularność, użyj tej samej metody
co w przypadku sugestii wyszukiwania.
Dalej: wyświetlanie wyników wyszukiwaniaarrow_forward
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2026-05-13 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2026-05-13 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"]]