設定您的自訂自動建議體驗Configure your custom autosuggest experience

自訂自動建議會傳回與您的搜尋體驗相關之建議的搜尋查詢字串。Custom Autosuggest returns a list of suggested search query strings that are relevant to your search experience. 建議的查詢字串是以使用者在搜尋方塊中提供的部分查詢字串為基礎。The suggested query strings are based on a partial query string that the user provides in the search box. 清單最多可包含 10 個建議。The list will contain a maximum of 10 suggestions.

您可以指定只傳回自訂的建議,或者也要包含 Bing 的建議。You specify whether to return only custom suggestions or to also include Bing suggestions. 如果您包含 Bing 的建議,自訂的建議會在 Bing 的建議前面出現。If you include Bing suggestions, custom suggestions appear before the Bing suggestions. 如果您提供足夠的相關建議,則傳回的建議清單可能不會包含 Bing 的建議。If you provide enough relevant suggestions, it's possible that the returned list of suggestions will not include Bing suggestions. Bing 的建議一律會在您的自訂搜尋執行個體內容中。Bing suggestions are always in the context of your Custom Search instance.

若要為您的執行個體設定搜尋查詢建議,請按一下 [自動建議]**** 索引標籤。To configure search query suggestions for your instance, click the Autosuggest tab.

注意

若要使用此功能,您必須訂閱適當等級的「自訂搜尋」(請參閱定價)。To use this feature, you must subscribe to Custom Search at the appropriate level (see pricing).

建議最多可能需要 24 小時才會反映在服務端點中 (API 或託管的 UI)。It can take up to 24 hours for suggestions to be reflected in the serving endpoint (API or hosted UI).

啟用 Bing 的建議Enable Bing suggestions

若要啟用 Bing 的建議,請將 [自動 Bing 建議]**** 滑桿切換到開啟的位置。To enable Bing suggestions, toggle the Automatic Bing suggestions slider to the on position. 滑桿會變成藍色。The slider becomes blue.

新增您自己的建議Add your own suggestions

若要新增您自己的查詢字串建議,請將它們新增到 [使用者定義建議]**** 底下的清單。To add your own query string suggestions, add them to the list under User-defined suggestions. 在清單中新增建議之後,按下 enter 鍵或按一下**+** 圖示。After adding a suggestion in the list, press the enter key or click the + icon. 您可以用任何語言指定建議。You can specify the suggestion in any language. 您可以新增最多 5000 個查詢字串建議。You can add a maximum of 5,000 query string suggestions.

上傳建議Upload suggestions

您可以選擇從檔案上傳建議清單。As an option, you can upload a list of suggestions from a file. 檔案中的每一行都必須包含一個搜尋查詢字串。The file must contain one search query string per line. 若要上傳檔案,請按一下上傳圖示並選取要上傳的檔案。To upload the file, click the upload icon and select the file to upload. 服務會從檔案擷取建議並將它們新增到清單。The service extracts the suggestions from the file and adds them to the list.

移除建議Remove suggestions

若要移除查詢字串建議,請按一下您要移除之建議旁的移除圖示。To remove a query string suggestion, click the remove icon next to the suggestion you want to remove.

封鎖建議Block suggestions

如果包含 Bing 的建議,您可以新增不希望 Bing 傳回的搜尋查詢字串清單。If you include Bing suggestions, you can add a list of search query strings you don't want Bing to return. 若要新增封鎖的查詢字串,請按一下 [顯示封鎖的建議]****。To add blocked query strings, click Show blocked suggestions. 將查詢字串新增至清單,然後按 enter 鍵或按一下**+** 圖示。Add the query string to the list and press the enter key or click the + icon. 您可以新增最多 50 個封鎖的查詢字串。You can add a maximum of 50 blocked query strings.

發佈或還原Publish or revert

您對自訂搜尋執行個體所做的變更位於 [組態] 索引標籤中,因此可以驗證您的變更。Changes you make to a Custom Search instance are made in the Configuration tab so you can validate your changes. 當您完成變更並準備好發佈之後,請按一下 [發佈] 。When you're done making changes and are ready to publish, click Publish. 一直要到您發佈之後,變更才會反映到您的生產環境端點。Changes are not reflected against your production endpoints until you publish.

在發佈之前,如果您決定不要保留所做的變更,請按一下 [還原] 。Before publishing, if you decide that you don't want to keep the changes you've made, click Revert. 當您還原變更時,即時狀態設定不會變更,而且 [設定] 索引標籤會還原以符合即時狀態。When you revert your changes, the live state configuration is unchanged and the Configuration tab is reverted to match the live state.

注意

這個程序可能需要 24 小時,自動建議設定的變更才會生效。It may take up to 24 hours for Custom Autosuggest configuration changes to take effect.

在託管的 UI 中啟用自動建議Enabling Autosuggest in Hosted UI

若要為託管的 UI 啟用查詢字串建議,請按一下 [託管的 UI]****。To enable query string suggestions for your hosted UI, click Hosted UI. 向下捲動到 [其他設定]**** 區段。Scroll down to the Additional Configuration section. 在 [Web 搜尋]**** 下,針對 [啟用自動建議]**** 選取 [開啟]****。Under Web search, select On for Enable autosuggest. 若要啟用自動建議,您必須選取包含搜尋方塊的版面配置。To enable Autosuggest, you must select a layout that includes a search box.

呼叫自動建議 APICalling the Autosuggest API

若要使用 Bing 自訂搜尋 API 取得建議的查詢字串,請傳送 GET 要求到下列端點。To get suggested query strings using the Bing Custom Search API, send a GET request to the following endpoint.

GET https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/Suggestions 

回應包含 SearchAction 物件清單,這些物件包含建議的查詢字串。The response contains a list of SearchAction objects that contain the suggested query strings.

        {  
            "displayText" : "sailing lessons seattle",  
            "query" : "sailing lessons seattle",  
            "searchKind" : "CustomSearch"  
        },  

每個建議都包含 displayTextquery 欄位。Each suggestion includes a displayText and query field. displayText 欄位包含建議的查詢字串,您可以用來填入搜尋方塊的下拉式清單。The displayText field contains the suggested query string that you use to populate your search box's dropdown list.

如果使用者從下拉式清單中選取建議的查詢字串,請在呼叫 Bing 自訂搜尋 API 時,在 query 欄位中使用該查詢字串。If the user selects a suggested query string from the dropdown list, use the query string in the query field when calling the Bing Custom Search API.

後續步驟Next steps