Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Esta página explica como ordenar os resultados de uma consulta de pesquisa na Web por data.
Para repositórios de dados que usam a pesquisa básica de sites, é possível ordenar por datas de páginas inferidas pelo Google.
Para repositórios de dados que usam indexação avançada de sites, é possível ordenar por atributos de dados personalizados ou datas de páginas inferidas pelo Google que são adicionadas ao esquema do repositório de dados. Para mais informações, consulte
Usar dados estruturados para indexação avançada de sites.
Antes de começar
Faça o seguinte:
Crie um repositório de dados com dados do site. Para mais informações, consulte URLs de sites.
Crie um app de pesquisa e conecte-o ao repositório de dados. Para mais informações,
consulte Criar um app de pesquisa.
Ordenar resultados da pesquisa básica no site
Para ordenar os resultados da pesquisa de um repositório de dados do site com a pesquisa básica de sites, siga estas etapas:
REST
O exemplo a seguir mostra como ordenar os resultados da pesquisa na Web para um app
com pesquisa básica de sites. Este exemplo usa o método
engines.servingConfigs.search:
Encontre o ID do app. Se você já tiver o ID do app, pule para a próxima etapa.
No console Google Cloud , acesse a página Aplicativos de IA.
ORDER_BY: a ordem em que os resultados são organizados. Por exemplo, para ordenar cronologicamente, especifique date para retornar páginas da Web classificadas por data inferida pelo Google. Para mais informações sobre a data da página inferida pelo Google, consulte a postagem do blog Como ajudar a Pesquisa Google a saber qual a melhor data para sua página da Web.
A ordem de classificação padrão é decrescente, em que as páginas com as datas mais recentes são retornadas primeiro. Para ter uma ordem de classificação crescente,
adicione :a ao valor date: date:a.
Ordenar os resultados da pesquisa para indexação avançada de sites
Para ordenar os resultados da pesquisa de um repositório de dados do site com indexação avançada, siga estas etapas:
REST
O exemplo a seguir mostra como ordenar os resultados da pesquisa na Web de um app
com indexação avançada de sites. Este exemplo usa o método
engines.servingConfigs.search:
Encontre o ID do app. Se você já tiver o ID do app, pule para a próxima etapa.
No console Google Cloud , acesse a página Aplicativos de IA.
ORDER_BY: a ordem em que os resultados são organizados. O campo pode ter valores dos seguintes tipos de dados: data/hora, inteiro ou número. Para ordenar cronologicamente, especifique o atributo de data personalizada no esquema ou a data da página inferida pelo Google para retornar páginas da Web classificadas por data. Por exemplo, para ordenar por um atributo date_edited PageMap, especifique o campo orderBy como "orderBy": "date_edited". A ordem de classificação padrão é crescente, em que as páginas mais antigas são retornadas primeiro. Para receber os resultados em ordem
decrescente, adicione desc ao valor do atributo personalizado. Por exemplo,
"orderBy":"date_edited desc".
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-19 UTC."],[[["\u003cp\u003eThis guide demonstrates how to order web search results by date for both basic and advanced website search configurations.\u003c/p\u003e\n"],["\u003cp\u003eFor basic website search, results can be sorted by Google-inferred page dates using the \u003ccode\u003eorderBy\u003c/code\u003e field set to \u003ccode\u003edate\u003c/code\u003e in the search query.\u003c/p\u003e\n"],["\u003cp\u003eAdvanced website indexing allows sorting by either Google-inferred page dates or custom data attributes defined in the data store schema.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eengines.servingConfigs.search\u003c/code\u003e method is the recommended approach for searching and ordering results for both basic and advanced configurations.\u003c/p\u003e\n"],["\u003cp\u003eWhen sorting, the default is descending order for basic web searches, and ascending order for advanced web searches, but this can be reversed by appending \u003ccode\u003e:a\u003c/code\u003e or \u003ccode\u003edesc\u003c/code\u003e, respectively, to the ordering value.\u003c/p\u003e\n"]]],[],null,["# Order web search results\n\nThis page explains how to order the results of a web search query by date.\n\n- For data stores that use basic website search, you can order by Google-inferred page dates.\n- For data stores that use advanced website indexing, you can order by custom data attributes or Google-inferred page dates that are added to the data store schema. For more information, see [Use structured data for advanced website indexing](/generative-ai-app-builder/docs/add-website-metadata).\n\nBefore you begin\n----------------\n\nMake sure that you do the following:\n\n- Create a data store with website data. For more information, see [Website\n URLs](/generative-ai-app-builder/docs/create-data-store-es#website).\n\n- Create a search app and connect it to the data store. For more information,\n see [Create a search app](/generative-ai-app-builder/docs/create-engine-es).\n\nOrder search results for basic website search\n---------------------------------------------\n\nTo order the search results for a website data store with\nbasic website search, follow these steps: \n\n### REST\n\nThe following sample shows how to to order your web search results for an app\nwith basic website search. This sample uses the\n[`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method:\n| **Note:** You can search over an app using the [`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method and you can search over a data store using the [`dataStores.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.servingConfigs/search) method. For the following procedure, Google recommends searching using the `engines.servingConfigs.search` method.\n\n1. Find your app ID. If you already have your app ID, skip to the next step.\n\n 1. In the Google Cloud console, go to the **AI Applications** page.\n\n [Go to Apps](https://console.cloud.google.com/gen-app-builder/engines)\n 2. On the **Apps** page, find the name of your app and get the app's ID from\n the **ID** column.\n\n2. Make a search query and include the `orderBy` field.\n\n **Key Term:** In Vertex AI Search, the term *app* can be used interchangeably with the term *engine* in the context of APIs. \n\n curl -X POST -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n \"https://discoveryengine.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search:search\" \\\n -d '{\n \"servingConfig\": \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search\",\n \"query\": \"\u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e\",\n \"orderBy\": \"\u003cvar translate=\"no\"\u003eORDER_BY\u003c/var\u003e\"\n }'\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project.\n - \u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e: the ID of the Vertex AI Search app.\n - \u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e: the query text to search.\n - \u003cvar translate=\"no\"\u003eORDER_BY\u003c/var\u003e: the order in which the results are arranged. For example, to order chronologically, specify `date` to return web pages sorted by Google-inferred page date. For more information on the Google-inferred page date, see the [Help Google Search know the best date for your web page](https://developers.google.com/search/blog/2019/03/help-google-search-know-best-date-for) blog post. The default sort order is descending, in which the pages with the most recent dates are returned first. To get ascending sort order, append `:a` to the `date` value---`date:a`.\n\n\u003cbr /\u003e\n\nOrder search results for advanced website indexing\n--------------------------------------------------\n\nTo order the search results for a website data store with\nadvanced website indexing, follow these steps: \n\n### REST\n\nThe following sample shows how to order your web search results for an app\nwith advanced website indexing. This sample uses the\n[`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method:\n| **Note:** You can search over an app using the [`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method and you can search over a data store using the [`dataStores.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.servingConfigs/search) method. For the following procedure, Google recommends searching using the `engines.servingConfigs.search` method.\n\n1. Find your app ID. If you already have your app ID, skip to the next step.\n\n 1. In the Google Cloud console, go to the **AI Applications** page.\n\n [Go to Apps](https://console.cloud.google.com/gen-app-builder/engines)\n 2. On the **Apps** page, find the name of your app and get the app's ID from\n the **ID** column.\n\n2. Make a search query and include the `orderBy` field.\n\n **Key Term:** In Vertex AI Search, the term *app* can be used interchangeably with the term *engine* in the context of APIs. \n\n curl -X POST -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n \"https://discoveryengine.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search:search\" \\\n -d '{\n \"servingConfig\": \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search\",\n \"query\": \"\u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e\",\n \"orderBy\": \"\u003cvar translate=\"no\"\u003eORDER_BY\u003c/var\u003e\"\n }'\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project.\n - \u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e: the ID of the Vertex AI Search app.\n - \u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e: the query text to search.\n - \u003cvar translate=\"no\"\u003eORDER_BY\u003c/var\u003e: the order in which the results are arranged. The field can have values that are of the following data types: datetime, integer, or number. To order chronologically, specify the custom date attribute specified in the schema or the Google-inferred page date to return web pages sorted by date. For example, to order by a `date_edited` PageMap attribute, you can specify the `orderBy` field as `\"orderBy\": \"date_edited\"`. The default sort order is ascending, in which older pages are returned first. To get the results in descending order, append `desc` to the custom attribute value---for example, `\"orderBy\":\"date_edited desc\"`.\n\n\u003cbr /\u003e"]]