Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En esta página, se explica cómo ordenar por fecha los resultados de una búsqueda web.
En el caso de los almacenes de datos que usan la búsqueda básica de sitios web, puedes ordenar por las fechas de las páginas inferidas por Google.
En el caso de los almacenes de datos que usan la indexación avanzada de sitios web, puedes ordenar por atributos de datos personalizados o por fechas de páginas inferidas por Google que se agregan al esquema del almacén de datos. Para obtener más información, consulta Usa datos estructurados para la indexación avanzada de sitios web.
Antes de comenzar
Asegúrate de hacer lo siguiente:
Crea un almacén de datos con datos del sitio web. Para obtener más información, consulta URLs de sitios web.
Crea una app de búsqueda y conéctala al almacén de datos. Para obtener más información, consulta Crea una app de búsqueda.
Ordena los resultados de la búsqueda básica en sitios web
Para ordenar los resultados de la búsqueda de un almacén de datos de sitios web con la búsqueda básica en sitios web, sigue estos pasos:
REST
En el siguiente ejemplo, se muestra cómo ordenar los resultados de la búsqueda web para una app con búsqueda básica en el sitio web. En este ejemplo, se usa el método engines.servingConfigs.search:
Busca el ID de tu app. Si ya tienes el ID de tu app, ve al siguiente paso.
En la consola de Google Cloud , ve a la página AI Applications.
PROJECT_ID: Es el ID de tu proyecto de Google Cloud .
APP_ID: Es el ID de la app de Vertex AI Search.
QUERY: Es el texto de la búsqueda.
ORDER_BY: Es el orden en el que se organizan los resultados. Por ejemplo, para ordenar cronológicamente, especifica date para devolver las páginas web ordenadas según la fecha de la página inferida por Google. Para obtener más información sobre la fecha de la página inferida por Google, consulta la entrada de blog Ayuda a la Búsqueda de Google a saber cuál es la mejor fecha para tu página web.
El orden de clasificación predeterminado es descendente, en el que las páginas con las fechas más recientes se muestran primero. Para obtener el orden de clasificación ascendente, agrega :a al valor de date: date:a.
Ordena los resultados de la búsqueda para la indexación avanzada de sitios web
Para ordenar los resultados de la búsqueda de un almacén de datos de sitios web con indexación avanzada de sitios web, sigue estos pasos:
REST
En el siguiente ejemplo, se muestra cómo ordenar los resultados de la búsqueda web para una app con indexación avanzada de sitios web. En este ejemplo, se usa el método engines.servingConfigs.search:
Busca el ID de tu app. Si ya tienes el ID de tu app, ve al siguiente paso.
En la consola de Google Cloud , ve a la página AI Applications.
PROJECT_ID: Es el ID de tu proyecto de Google Cloud .
APP_ID: Es el ID de la app de Vertex AI Search.
QUERY: Es el texto de la búsqueda.
ORDER_BY: Es el orden en el que se organizan los resultados. El campo puede tener valores de los siguientes tipos de datos: fecha y hora, número entero o número. Para ordenar cronológicamente, especifica el atributo de fecha personalizada que se indica en el esquema o la fecha de la página inferida por Google para devolver las páginas web ordenadas por fecha. Por ejemplo, para ordenar por un atributo date_edited de PageMap, puedes especificar el campo orderBy como "orderBy": "date_edited". El orden de clasificación predeterminado es ascendente, por lo que las páginas más antiguas se muestran primero. Para obtener los resultados en orden descendente, agrega desc al valor del atributo personalizado, por ejemplo, "orderBy":"date_edited desc".
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-05 (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"]]