如果資料商店使用基本網站搜尋功能,商店索引的新鮮度會與 Google 搜尋的新鮮度一致。
如果資料儲存庫已啟用進階網站索引功能,系統會透過下列方式重新整理資料儲存庫中的網頁:
- 自動重新整理
- 手動重新整理
- 以 Sitemap 為基礎的重新整理
本頁說明自動和手動重新整理。如要瞭解及實作以網站地圖為基礎的重新整理功能,請參閱「根據網站地圖建立索引及重新整理」。
自動重新整理
Vertex AI Search 會自動重新整理,方式如下:
- 建立資料儲存區後,系統會為內含的網頁產生初始索引。
- 完成初始索引後,系統會盡量為新發現的網頁建立索引,並重新檢索現有網頁。
- 如果資料存放區的查詢率為 50 次查詢/30 天,系統就會定期重新整理資料存放區。
手動重新整理
如要重新整理已啟用「進階網站索引建立功能」的資料儲存庫中特定網頁,可以呼叫 recrawlUris
方法。您可以使用 uris
欄位,指定要檢索的每個網頁。recrawlUris
方法是長時間執行的作業,會持續執行直到指定網頁完成檢索,或在 24 小時後逾時 (以先發生者為準)。如果 recrawlUris
方法逾時,您可以再次呼叫該方法,並指定要檢索的網頁。您可以輪詢 operations.get
方法,監控重新檢索作業的狀態。
重新檢索的限制
檢索網頁的頻率和數量都有限制:
- 每日通話量。每項專案每天最多只能呼叫
recrawlUris
方法 20 次。 - 每次通話的網頁數。透過呼叫
recrawlUris
方法指定uris
值時,最多可指定 10,000 個值。
重新檢索資料儲存庫中的網頁
如果資料儲存庫已啟用「進階網站索引建立功能」,您可以手動檢索特定網頁。
REST
如要使用指令列檢索資料儲存庫中的特定網頁,請按照下列步驟操作:
找出資料儲存庫 ID。如果已有資料商店 ID,請跳到下一個步驟。
前往 Google Cloud 控制台的「AI Applications」頁面,然後在導覽選單中點選「Data Stores」。
點按資料儲存庫的名稱。
在資料儲存庫的「資料」頁面中,取得資料儲存庫 ID。
呼叫
recrawlUris
方法,並使用uris
欄位指定要檢索的每個網頁。即使包含星號 (*
),每個uri
都代表單一網頁。系統不支援萬用字元模式。curl -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -H "X-Goog-User-Project: PROJECT_ID" \ "https://discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID/locations/global/collections/default_collection/dataStores/DATA_STORE_ID/siteSearchEngine:recrawlUris" \ -d '{ "uris": [URIS] }'
更改下列內容:
PROJECT_ID
:您的 Google Cloud 專案 ID。DATA_STORE_ID
:Vertex AI Search 資料儲存庫的 ID。URIS
:您要檢索的網頁清單,例如"https://example.com/page-1", "https://example.com/page-2", "https://example.com/page-3"
。
輸出結果會與下列內容相似:
{ "name": "projects/PROJECT_ID/locations/global/collections/default_collection/dataStores/DATA_STORE_ID/operations/recrawl-uris-0123456789012345678", "metadata": { "@type": "type.googleapis.com/google.cloud.discoveryengine.v1alpha.RecrawlUrisMetadata" } }
監控重新檢索作業的狀態時,請將
name
值儲存為operations.get
作業的輸入內容。
監控重新檢索作業的狀態
您用來檢索資料存放區中的網頁的「recrawlUris
」方法是長時間執行的作業,會持續執行,直到檢索完您指定的網頁,或在 24 小時後逾時為止 (以先到者為準)。如要監控這項長時間執行的作業狀態,請輪詢 operations.get
方法,並指定 recrawlUris
方法傳回的 name
值。持續輪詢,直到回應指出下列任一情況:(1) 所有網頁都已檢索完畢,或 (2) 作業在檢索完所有網頁前逾時。如果 recrawlUris
逾時,您可以再次呼叫,並指定未檢索的網站。
REST
如要使用指令列監控重新檢索作業的狀態,請按照下列步驟操作:
找出資料儲存庫 ID。如果已有資料商店 ID,請跳到下一個步驟。
前往 Google Cloud 控制台的「AI Applications」頁面,然後在導覽選單中點選「Data Stores」。
點按資料儲存庫的名稱。
在資料儲存庫的「資料」頁面中,取得資料儲存庫 ID。
輪詢
operations.get
方法。curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -H "X-Goog-User-Project: PROJECT_ID" \ "https://discoveryengine.googleapis.com/v1alpha/OPERATION_NAME"
更改下列內容:
PROJECT_ID
:您的 Google Cloud 專案 ID。OPERATION_NAME
:作業名稱,位於對recrawlUris
方法進行呼叫時傳回的name
欄位中,請參閱「重新檢索資料存放區中的網頁」。您也可以列出長時間執行的作業,以取得作業名稱。
評估每則回覆。
如果回應指出有待處理的 URI,且重新檢索作業尚未完成,表示系統仍在檢索網頁。繼續輪詢。
範例
{ "name": "projects/PROJECT_ID/locations/global/collections/default_collection/dataStores/DATA_STORE_ID/operations/recrawl-uris-0123456789012345678", "metadata": { "@type": "type.googleapis.com/google.cloud.discoveryengine.v1alpha.RecrawlUrisMetadata", "createTime": "2023-09-05T22:07:28.690950Z", "updateTime": "2023-09-05T22:22:10.978843Z", "validUrisCount": 4000, "successCount": 2215, "pendingCount": 1785 }, "done": false, "response": { "@type": "type.googleapis.com/google.cloud.discoveryengine.v1alpha.RecrawlUrisResponse", } }
回應欄位說明如下:
createTime
:表示長時間執行的作業開始時間。updateTime
:表示上次更新長時間執行作業中繼資料的時間。表示中繼資料每五分鐘更新一次,直到作業完成為止。validUrisCount
:表示您在呼叫recrawlUris
方法時,指定了 4,000 個有效 URI。successCount
:表示已成功檢索 2,215 個 URI。pendingCount
:表示有 1,785 個 URI 尚未檢索。done
:值為false
表示重新檢索作業仍在進行中。
如果回應指出沒有待處理的 URI (未傳回任何
pendingCount
欄位),且重新檢索作業已完成,則表示網頁已檢索完畢。停止輪詢,您可以結束這項程序。範例
{ "name": "projects/PROJECT_ID/locations/global/collections/default_collection/dataStores/DATA_STORE_ID/operations/recrawl-uris-0123456789012345678", "metadata": { "@type": "type.googleapis.com/google.cloud.discoveryengine.v1alpha.RecrawlUrisMetadata", "createTime": "2023-09-05T22:07:28.690950Z", "updateTime": "2023-09-05T22:37:11.367998Z", "validUrisCount": 4000, "successCount": 4000 }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.discoveryengine.v1alpha.RecrawlUrisResponse" } }
回應欄位說明如下:
createTime
:表示長時間執行的作業開始時間。updateTime
:表示上次更新長時間執行作業中繼資料的時間。表示中繼資料每五分鐘更新一次,直到作業完成為止。validUrisCount
:表示您在呼叫recrawlUris
方法時,指定了 4,000 個有效 URI。successCount
:表示已成功檢索 4,000 個 URI。done
:值為true
表示重新檢索作業已完成。
如果回應指出有待處理的 URI,且重新檢索作業已完成,則表示重新檢索作業在檢索所有網頁前逾時 (24 小時後)。請從「重新檢索資料儲存庫中的網頁」開始。在對
recrawlUris
方法的新呼叫中,使用operations.get
回應中的failedUris
值做為uris
欄位的值。Example.
{ "name": "projects/PROJECT_ID/locations/global/collections/default_collection/dataStores/DATA_STORE_ID/operations/recrawl-uris-8765432109876543210", "metadata": { "@type": "type.googleapis.com/google.cloud.discoveryengine.v1alpha.RecrawlUrisMetadata", "createTime": "2023-09-05T22:07:28.690950Z", "updateTime": "2023-09-06T22:09:10.613751Z", "validUrisCount": 10000, "successCount": 9988, "pendingCount": 12 }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.discoveryengine.v1alpha.RecrawlUrisResponse", "failedUris": [ "https://example.com/page-9989", "https://example.com/page-9990", "https://example.com/page-9991", "https://example.com/page-9992", "https://example.com/page-9993", "https://example.com/page-9994", "https://example.com/page-9995", "https://example.com/page-9996", "https://example.com/page-9997", "https://example.com/page-9998", "https://example.com/page-9999", "https://example.com/page-10000" ], "failureSamples": [ { "uri": "https://example.com/page-9989", "failureReasons": [ { "corpusType": "DESKTOP", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." }, { "corpusType": "MOBILE", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." } ] }, { "uri": "https://example.com/page-9990", "failureReasons": [ { "corpusType": "DESKTOP", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." }, { "corpusType": "MOBILE", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." } ] }, { "uri": "https://example.com/page-9991", "failureReasons": [ { "corpusType": "DESKTOP", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." }, { "corpusType": "MOBILE", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." } ] }, { "uri": "https://example.com/page-9992", "failureReasons": [ { "corpusType": "DESKTOP", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." }, { "corpusType": "MOBILE", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." } ] }, { "uri": "https://example.com/page-9993", "failureReasons": [ { "corpusType": "DESKTOP", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." }, { "corpusType": "MOBILE", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." } ] }, { "uri": "https://example.com/page-9994", "failureReasons": [ { "corpusType": "DESKTOP", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." }, { "corpusType": "MOBILE", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." } ] }, { "uri": "https://example.com/page-9995", "failureReasons": [ { "corpusType": "DESKTOP", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." }, { "corpusType": "MOBILE", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." } ] }, { "uri": "https://example.com/page-9996", "failureReasons": [ { "corpusType": "DESKTOP", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." }, { "corpusType": "MOBILE", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." } ] }, { "uri": "https://example.com/page-9997", "failureReasons": [ { "corpusType": "DESKTOP", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." }, { "corpusType": "MOBILE", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." } ] }, { "uri": "https://example.com/page-9998", "failureReasons": [ { "corpusType": "DESKTOP", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." }, { "corpusType": "MOBILE", "errorMessage": "Page was crawled but was not indexed by UCS within 24 hours." } ] } ] } }
以下是回應欄位的說明:
createTime
:長時間執行的作業開始時間。updateTime
。上次更新長時間執行作業中繼資料的時間。中繼資料每五分鐘更新一次,直到作業完成為止。validUrisCount
:表示您在呼叫recrawlUris
方法時指定了 10,000 個有效 URI。successCount
。表示已成功檢索 9,988 個 URI。pendingCount
。表示有 12 個 URI 尚未檢索。done
。值為true
表示重新檢索作業已完成。failedUris
。在重新檢索作業逾時前未檢索的 URI 清單。failureInfo
。無法檢索的 URI 相關資訊。即使有超過十個 URI 無法檢索,系統最多只會傳回十個failureInfo
陣列值。errorMessage
。URI 無法檢索的原因 (corpusType
)。詳情請參閱錯誤訊息。
及時重新整理
Google 建議您對新網頁和更新後的網頁執行手動重新整理,確保您擁有最新索引。
錯誤訊息
監控重新檢索作業的狀態時,如果在輪詢 operations.get
方法時,重新檢索作業逾時,operations.get
會針對未檢索的網頁傳回錯誤訊息。下表列出錯誤訊息、錯誤是否為暫時性 (會自行解決的暫時性錯誤),以及在重試 recrawlUris
方法前可採取的動作。您可以立即重試所有暫時性錯誤。實作補救措施後,即可重試所有非暫時性錯誤。
錯誤訊息 | 這是暫時性錯誤嗎? | 重試重新檢索前的動作 |
---|---|---|
網頁已遭檢索,但 Vertex AI Search 未在 24 小時內建立索引 | 是 | 呼叫 recrawlUris 方法時,請使用 operations.get 回應中的 failedUris 值,做為 uris 欄位中的值。 |
網站的 robots.txt 封鎖了檢索作業 |
否 | 在網站的 robots.txt 檔案中解除封鎖 URI,確保 Googlebot 使用者代理程式可檢索網站,然後重試重新檢索。詳情請參閱「如何編寫及提交 robots.txt 檔案」。如果無法存取 robots.txt 檔案,請與網域擁有者聯絡。 |
無法連上網頁 | 否 | 檢查您在呼叫 recrawlUris 方法時指定的 URI。請務必提供實際 URI,而非 URI 模式。 |
檢索逾時 | 是 | 呼叫 recrawlUris 方法時,請使用 operations.get 回應中的 failedUris 值,做為 uris 欄位中的值。 |
Google 檢索器拒絕存取網頁 | 是 | 呼叫 recrawlUris 方法時,請使用 operations.get 回應中的 failedUris 值,做為 uris 欄位中的值。 |
Google 檢索器無法追蹤網址 | 否 | 如有多次重新導向,請使用最後一次重新導向的 URI 並重試 |
找不到網頁 (404) | 否 | 檢查您在呼叫 recrawlUris 方法時指定的 URI。請務必提供實際 URI,而非 URI 模式。
如果網頁傳回 `4xx` 錯誤代碼,就會從索引中移除。 |
頁面需要驗證 | 否 | 進階網站索引功能不支援檢索需要驗證的網頁。 |
如何處理已刪除的網頁
刪除網頁後,Google 建議手動重新整理已刪除的網址。
在自動或手動重新整理期間,如果系統檢索網站資料存放區時,網頁傳回 4xx
用戶端錯誤代碼或 5xx
伺服器錯誤代碼,系統就會從索引中移除沒有回應的網頁。