使用自動和手動重新整理功能重新整理網頁

如果資料儲存庫使用基本網站搜尋功能,則儲存庫索引的最新程度會與 Google 搜尋的最新程度相同。

如果資料儲存庫已啟用進階網站索引建立功能,資料儲存庫中的網頁會以以下方式重新整理:

  • 自動重新整理
  • 手動重新整理
  • 以 Sitemap 為依據的重新整理

本頁說明自動和手動重新整理。如要瞭解並實作以網站地圖為依據的重新整理功能,請參閱「根據網站地圖建立索引和重新整理」一文。

自動重新整理

Vertex AI Search 會自動執行以下動作:

  • 建立資料儲存庫後,系統會為所包含的網頁產生初始索引。
  • 初始索引完成後,系統會為所有新發現的網頁建立索引,並盡力重新檢索現有網頁。
  • 會定期重新整理資料儲存庫,如果查詢率達到 50 次/30 天,就會進行重新整理。

手動重新整理

如果您想在啟用進階網站索引的資料儲存庫中,重新整理特定網頁,可以呼叫 recrawlUris 方法。您可以使用 uris 欄位指定要檢索的每個網頁。recrawlUris 方法是長時間執行的作業,會一直執行,直到檢索指定的網頁或在 24 小時後逾時 (以先發生者為準)。如果 recrawlUris 方法逾時,您可以再次呼叫該方法,指定要繼續檢索的網頁。您可以輪詢 operations.get 方法,監控重新檢索作業的狀態

重新檢索的限制

您可以檢索網頁的頻率和每次檢索的網頁數量皆有限制:

  • 每日通話次數:每個專案每天最多允許 recrawlUris 方法的呼叫次數為 20 次。
  • 每個呼叫的網頁數量。您最多可透過 recrawlUris 方法的呼叫指定 10,000 個 uris 值。

重新檢索資料儲存庫中的網頁

您可以在已開啟進階網站索引建立功能的資料儲存庫中,手動檢索特定網頁。

REST

如要使用指令列在資料儲存庫中檢索特定網頁,請按照下列步驟操作:

  1. 找出資料儲存庫 ID。如果您已取得資料儲存庫 ID,請略過至下一個步驟。

    1. 前往 Google Cloud 控制台的「AI Applications」頁面,然後在導覽選單中按一下「資料儲存庫」

      前往「資料儲存庫」頁面

    2. 點按資料儲存庫的名稱。

    3. 在資料儲存庫的「資料」頁面中,取得資料儲存庫 ID。

  2. 呼叫 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"
      }
    }
    
  3. 監控重新檢索作業狀態時,請將 name 值儲存為 operations.get 作業的輸入內容。

監控重新檢索作業的狀態

recrawlUris 方法可用於在資料儲存庫中檢索網頁,這是一項長時間執行的作業,會一直執行,直到指定的網頁檢索完成,或 24 小時後逾時,以先到者為準。您可以透過輪詢 operations.get 方法,指定 recrawlUris 方法傳回的 name 值,監控這項長時間執行作業的狀態。請繼續輪詢,直到回應指出 (1) 所有網頁都已檢索,或 (2) 在檢索完所有網頁前作業逾時為止。如果 recrawlUris 逾時,您可以再次呼叫,並指定未檢索的網站。

REST

如要使用指令列監控重新檢索作業的狀態,請按照下列步驟操作:

  1. 找出資料儲存庫 ID。如果您已取得資料儲存庫 ID,請略過至下一個步驟。

    1. 前往 Google Cloud 控制台的「AI Applications」頁面,然後在導覽選單中按一下「資料儲存庫」

      前往「資料儲存庫」頁面

    2. 點按資料儲存庫的名稱。

    3. 在資料儲存庫的「資料」頁面中,取得資料儲存庫 ID。

  2. 輪詢 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"
    

    更改下列內容:

  3. 評估每個回覆。

    • 如果回應指出有待處理的 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 表示重新檢索作業已完成。
  4. 如果回應指出有待處理的 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 陣列值。
    • errorMessagecorpusType 未能檢索 URI 的原因。詳情請參閱「錯誤訊息」。

及時重新整理

Google 建議你對新頁面和更新的頁面執行手動重新整理作業,確保你擁有最新的索引。

錯誤訊息

監控重新檢索作業狀態時,如果在您輪詢 operations.get 方法時,重新檢索作業逾時,operations.get 會針對未檢索的網頁傳回錯誤訊息。下表列出錯誤訊息、錯誤是否為暫時性 (會自動修正的暫時性錯誤),以及在重試 recrawlUris 方法前可採取的動作。您可以立即重試所有暫時性錯誤。實施補救措施後,所有暫時性錯誤都可以重試。

錯誤訊息 這是暫時性錯誤嗎? 重試重新檢索前的動作
網頁已被檢索,但未在 24 小時內由 Vertex AI Search 編入索引 呼叫 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 伺服器錯誤代碼,系統就會將沒有回應的網頁從索引中移除。