Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara mengurutkan hasil kueri penelusuran web menurut tanggal.
Untuk penyimpanan data yang menggunakan penelusuran situs dasar, Anda dapat mengurutkan berdasarkan
tanggal halaman yang disimpulkan Google.
Untuk penyimpanan data yang menggunakan pengindeksan situs lanjutan, Anda dapat mengurutkan berdasarkan atribut data kustom atau tanggal halaman yang disimpulkan Google yang ditambahkan ke skema penyimpanan data. Untuk mengetahui informasi selengkapnya, lihat Menggunakan data terstruktur untuk pengindeksan situs lanjutan.
Sebelum memulai
Pastikan Anda melakukan hal berikut:
Buat penyimpanan data dengan data situs. Untuk mengetahui informasi selengkapnya, lihat URL
Situs.
Buat aplikasi penelusuran dan hubungkan ke penyimpanan data. Untuk mengetahui informasi selengkapnya,
lihat Membuat aplikasi penelusuran.
Mengurutkan hasil penelusuran untuk penelusuran situs dasar
Untuk mengurutkan hasil penelusuran untuk penyimpanan data situs dengan penelusuran situs dasar, ikuti langkah-langkah berikut:
REST
Contoh berikut menunjukkan cara mengurutkan hasil penelusuran web untuk aplikasi dengan penelusuran situs dasar. Contoh ini menggunakan metode
engines.servingConfigs.search:
Temukan ID aplikasi Anda. Jika Anda sudah memiliki ID aplikasi, lanjutkan ke langkah berikutnya.
Di konsol Google Cloud , buka halaman AI Applications.
ORDER_BY: urutan hasil disusun. Misalnya, untuk mengurutkan secara kronologis, tentukan date untuk menampilkan halaman web yang diurutkan berdasarkan tanggal halaman yang disimpulkan Google. Untuk mengetahui informasi selengkapnya tentang
tanggal halaman yang disimpulkan Google, lihat postingan blog
Membantu Google Penelusuran mengetahui tanggal terbaik untuk halaman web Anda.
Urutan pengurutan default adalah menurun, dengan halaman yang memiliki
tanggal terbaru ditampilkan terlebih dahulu. Untuk mendapatkan urutan pengurutan menaik,
tambahkan :a ke nilai date—date:a.
Mengurutkan hasil penelusuran untuk pengindeksan situs lanjutan
Untuk mengurutkan hasil penelusuran untuk penyimpanan data situs dengan pengindeksan situs lanjutan, ikuti langkah-langkah berikut:
REST
Contoh berikut menunjukkan cara mengurutkan hasil penelusuran web untuk aplikasi
dengan pengindeksan situs lanjutan. Contoh ini menggunakan metode
engines.servingConfigs.search:
Temukan ID aplikasi Anda. Jika Anda sudah memiliki ID aplikasi, lanjutkan ke langkah berikutnya.
Di konsol Google Cloud , buka halaman AI Applications.
ORDER_BY: urutan hasil disusun. Kolom
dapat memiliki nilai yang berupa tipe data berikut: datetime,
integer, atau angka. Untuk mengurutkan secara kronologis, tentukan atribut tanggal kustom yang ditentukan dalam skema atau tanggal halaman yang disimpulkan Google untuk menampilkan halaman web yang diurutkan menurut tanggal. Misalnya, untuk mengurutkan menurut atribut PageMap
date_edited, Anda dapat menentukan kolom orderBy
sebagai "orderBy": "date_edited". Urutan pengurutan default adalah menaik, dengan halaman yang lebih lama ditampilkan terlebih dahulu. Untuk mendapatkan hasil dalam urutan
menurun, tambahkan desc ke nilai atribut kustom—misalnya,
"orderBy":"date_edited desc".
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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"]]