如何將精簡器新增至 SharePoint Server 中的搜尋結果頁面How to add refiners to your search results page in SharePoint Server

摘要:了解如何將精簡器新增至 SharePoint Server 中的搜尋結果頁面。Summary: Learn how to add refiners to your search results page in SharePoint Server.

在這一系列使用 SharePoint Server 中的搜尋結果頁面上的精簡器的計劃、 上一篇文章顯示如何識別及規劃您的網站上使用精簡器。在本文中,您將了解:The previous article in this series, Plan to use refiners on a search results page in SharePoint Server, showed how to identify and plan to use refiners on your site. In this article, you'll learn:

如何將編目的屬性對應到可精簡搜尋的 managed 屬性How to map a crawled property to a refinable managed property

在搜尋中心案例中,我們知道我們想要使用下列可精簡搜尋的 managed 的屬性:In our Search Center scenario, we knew we wanted to use the following refinable managed properties:

若要使用的精簡器Refiner to use 可精簡搜尋的 managed 的屬性Refinable managed property
ManagerManager
RefinableString01RefinableString01
內部編寫器Internal Writer
RefinableString02RefinableString02
編輯器Editor
RefinableString03RefinableString03
內容類型Content Type
RefinableString04RefinableString04
要求的發佈日期Requested Publish Date
RefinableDate01RefinableDate01

用於將編目的屬性對應到可精簡搜尋的 managed 屬性的程序是相同的所有精簡器。下列範例中的程序說明我們如何對應至RefinableString01可精簡搜尋的 managed 屬性代表內部編寫器的編目的屬性。The procedure for mapping a crawled property to a refinable managed property is the same for all refiners. The following example procedure explains how we mapped the crawled property that represents Internal Writer to the RefinableString01 refinable managed property.

  1. 在您的搜尋中心,在 [網站設定] 頁面上選取 [搜尋結構描述On your Search Center, on the Site Settings page, select Search Schema.

    Search Schema

  2. 在 [ Managed 屬性] 欄位中輸入您要編目的屬性,對應至可精簡搜尋的 managed 屬性的名稱和 [箭號] 按鈕。In the Managed property field, type the name of the refinable managed property to which you want to map a crawled property, and then click the arrow button.

    在我們的案例中,我們輸入RefinableString01In our scenario, we typed RefinableString01 .

    搜尋 RefinableString01

  3. 從 [屬性名稱] 欄位中,選取 [編輯/對應屬性]。From the Property Name field, select Edit/Map Property.

    Edit Property

  4. 在 [編輯 Managed 屬性] 頁面上按一下 [新增對應]。On the Edit Managed Property page, click Add a Mapping.

    Add A Mapping

  5. 編目屬性選項] 對話方塊中,使用 [搜尋編目的屬性名稱] 欄位來搜尋您想要對應至這個可精簡搜尋的 managed 屬性的編目屬性。In the Crawled property selection dialog box, use the Search for crawled property name field to search for the crawled property that you want to map to this refinable managed property.

    在我們的案例中,我們知道我們想要使用網站欄名內部的作者。編目的屬性不含空格。因此,我們輸入InternalWriterIn our scenario, we knew we wanted to use the site column called Internal Writer . Crawled properties don't contain spaces. Therefore, we entered InternalWriter .

    搜尋內部作者

    找不到兩個編目的屬性: ows_q_USER_Internal_Writerows_Internal_WriterTwo crawled properties were found: ows_q_USER_Internal_Writer and ows_Internal_Writer .

    已傳回兩個 CP

    如果您在這裡有問題,您混淆為理解。此組件會有難度。有實際上兩個編目的屬性,讓似乎怪異考慮我們有一個內部作者網站欄。讓哪些編目的屬性應該我們選擇要對應至可精簡搜尋的 managed 屬性?If you have questions here, your confusion is understandable. This part is somewhat tricky. There are actually two crawled properties, which might seem strange, considering that we have only one Internal Writer site column. So which crawled property should we choose to map to the refinable managed property?

    我們看接近項目將要上。兩個編目屬性之間的差異是前置詞。一個具有ows_q_USER_前置詞,而另有ows_Let's take a closer look at what's going on. The difference between the two crawled properties is the prefix. One has an ows_q_USER_ prefix, and the other has ows_ .

    重要

    對應到可精簡搜尋的 managed 屬性的編目的屬性、 時選取 [以ows_前置字元的編目的屬性。When mapping a crawled property to a refinable managed property, select the crawled property with the ows_ prefix.

    如果您想要編目及 managed 屬性的命名慣例的詳細資訊,請參閱從 managed 屬性集的網站欄功能的?If you want more information about the naming convention for crawled and managed properties, see From site column to managed property - What's up with that?.

  6. 選取的編目的屬性以ows_前置詞,然後按一下 [確定]Select the crawled property with the ows_ prefix, and then click OK.

    在我們的案例中,選取 [ ows_Internal_WriterIn our scenario, we selected ows_Internal_Writer .

    選取 CP

    在 [編輯 Managed 屬性] 頁面上注意到的編目的屬性已新增至對應至編目屬性] 欄位On the Edit Managed Property page, notice that the crawled property is added to the Mappings to crawled property field.

    對應的 CP

  7. 在 [別名] 欄位中輸入精簡器的名稱。In the Alias field, enter a name for the refiner.

    在我們的案例中,我們輸入InternalWriterIn our scenario, we entered InternalWriter .

    別名欄位

    請務必了解您在此處輸入別名為精簡器名稱會顯示在搜尋結果頁面。此別名當做以方便您生活的位元時您正在設定精簡器在精簡搜尋網頁組件(請參閱下面的程序)。請記住,就無法變更可精簡搜尋的 managed 屬性的名稱。因此,當您執行組態時,需要處理許多可精簡搜尋的 managed 屬性相似名稱、 RefinableString01RefinableString02等等讓別名是很好的提醒的對應至哪一個值屬性。It's important to understand that the alias that you enter here is not the refiner name that will be shown on your search results page. This alias is meant to make your life a bit easier when you're configuring refiners in the **Refinement Web Part (see procedure below). Remember, you can't change the name of the refinable managed property. Therefore, when you do the configuration, you'll have to deal with many refinable managed properties that have similar names, RefinableString01 , RefinableString02 and so on So, the alias is a good reminder of which value that you mapped to the property.

  8. 若要完成對應,按一下 [確定]To finish the mapping, click OK.

    完成對應

    下列螢幕擷取畫面顯示的最終結果之後剩餘的四個精簡器重複上述程序的步驟。The following screen shots show the final result after repeating the steps from the procedure above for the remaining four refiners.

    可精簡搜尋日期

    可精簡搜尋字串

如何啟動清單或文件庫重新索引How to initiate a reindexing of a list or library

當您已對應所有可精簡搜尋 managed 的屬性要使用時,您必須執行動作的清單或文件庫重新索引。如需如何執行作業的資訊,請參閱 <如何建立搜尋中心網站集合及啟用 SharePoint Server 的內容編目When you've mapped all the refinable managed properties that you want to use, you have to do a reindexing of your list or library. For information on how to do that, see How to create a Search Center Site Collection and enable crawling of your content in SharePoint Server.

如何設定精簡搜尋網頁組件使用自訂精簡器How to configure the Refinement Web Part to use custom refiners

根據預設,精簡搜尋網頁組件會包含在搜尋結果頁面上。在先前的部落格文章我顯示您如何設定搜尋結果網頁組件以使用新的結果來源。也已顯示兩個精簡器作者修改日期By default, the Refinement Web Part is included on the search results page. In the previous blog post I showed you how to configure the Search Results Web Part to use a new result source. The two refiners Author and Modified date were also displayed.

預設精簡器

若要顯示自訂精簡器,以下是您應該執行的動作:To display custom refiners, here's what you should do:

  1. 在 [搜尋結果] 頁面上按一下 [設定] 功能表和 [編輯頁面]On the search results page, click the Settings menu, and then click Edit Page.

  2. 精簡搜尋網頁組件[網頁組件功能表] 和 [編輯網頁組件In the Refinement Web Part, click the Web Part Menu, and then click Edit Web Part.

    編輯網頁組件

  3. 在 [網頁組件] 工具窗格中,按一下 [選擇精簡器In the Web Part tool pane, click Choose Refiners.

    選擇精簡器

  4. 在 [選取的精簡器] 區段中選取 [精簡器不想要顯示在搜尋結果頁面,然後按一下 [移除]。In the Selected refiners section, select the refiners that you don't want to display on your search results page, and then click Remove.

    在我們的案例中,我們會移除所有預設精簡器。In our scenario, we removed all the default refiners.

    移除精簡器

  5. 在 [可用的精簡器] 區段中向下捲動並選取 [可精簡搜尋的 managed 的屬性。In the Available refiners section, scroll down and select a refinable managed property.

    在我們的案例中,我們已選取RefinableString1。 這是可精簡搜尋的 managed 的屬性對應至編目的屬性ows_Internal_Writer 。請注意範例值會顯示 (良好符號,我們是依向右路徑),與別名InternalWriterIn our scenario, we selected RefinableString1. This is the refinable managed property that is mapped to the crawled property ows_Internal_Writer . Notice that sample values are shown (a good sign that we're on the right path), together with the alias InternalWriter .

    選取的 RefinableString01

  6. 按一下 [新增]。Click Add.

    新增精簡器

    這停留RefinableString01屬性至選取的精簡器] 區段。當精簡器移至 [選定精簡器] 區段中時,會顯示其他設定選項。他們會述步驟 10 和 11。This moves the RefinableString01 property over to the Selected refiners section. When a refiner is moved over to the Selected refiners section, additional configuration options are shown. They will be explained in steps 10 and 11.

    精簡器設定

  7. 重複步驟 5 與 6,以新增您想要使用的搜尋結果頁面上的精簡的器。Repeat steps 5 and 6 to add all the refiners you want to use on your search results page.

    在我們的案例中,我們加入五個可精簡搜尋的 managed 的屬性我們在上一節中設定。In our scenario, we added the five refinable managed properties that we configured in the previous section.

    選取的精簡器

  8. 若要預覽的精簡器,請按一下 [預覽精簡器To preview the refiners, click Preview Refiners.

    預覽精簡器

  9. 若要變更精簡器的顯示順序,選取您要移動、 精簡的器和 [上移下移按鈕。To change the display order of refiners, select the refiner you want to move, and then click the Move up or Move down button.

    在我們的案例中,我們選取RefinableString04 (請注意的別名),並選取向上移動直到它所選取的精簡器] 區段中的第一個屬性。In our scenario, we selected RefinableString04 (notice the Alias name), and selected Move up until it was the first property in the Selected refiners section.

    將修簡器上移

  10. 若要讓使用者選取多個精簡器值,從 [顯示範本] 功能表選取 [多重值精簡搜尋項目To enable users to select multiple refiner values, from the Display template menu, select Multi-value Refinement Item.

    多值精簡搜尋

    我們再次按一下預覽精簡器並確認ContentType精簡器 (RefinableString04) 已顯示第一次,且其鎖會讓使用者選取多個精簡器值的核取方塊。We clicked Preview refiners again, and verified that the ContentType refiner (RefinableString04) was displayed first, and that it had check boxes that would enable users to select multiple refiner values.

    預覽多值精簡器

    我們可以重複此步驟RefinableString01RefinableString02 ,以及RefinableString03精簡器。We repeated this step for the refiners RefinableString01 , RefinableString02 , and RefinableString03 .

    RefinableDate01精簡器代表要求發行日期。根據預設,難使用者看到的日期範圍清單中顯示精簡器值。The RefinableDate01 refiner represents Requested publish date . By default, the refiner values are shown in a list, which makes it difficult for users to see the date range.

    預設精簡器日期

    若要從 [顯示範本] 功能表的精簡搜尋設定] 對話方塊中,更容易記住方式顯示精簡器值我們選取含有長條圖的滑動軸。在 [日期] 區段中,我們選取最後一天、 一週、 一個月六個月及年To display the refiner values in a more user-friendly way, in the Refinement configuration dialog box, from the Display template menu, we selected Slider with bar graph. In the Dates section, we selected Last day, week, month, six months and year.

    設定含條欄的滑桿

    當我們現在預覽適用的精簡器時,要求的發佈日期精簡器 ( RefinableDate01 ) 的值已完全顯示為圖形。When we now previewed our refiners, the values for the Requested Publish Date refiner ( RefinableDate01 ) were perfectly displayed as a graph.

    預覽含圖形的滑桿

    但是,有我們需要以改善的多個事: 精簡器顯示名稱。 RefinableString01RefinableString02 、 等等不要對使用者進行大的意義。But, there was more thing that we needed to improve: the refiner display names. RefinableString01 , RefinableString02 , and so on do not make much sense to users.

  11. 若要變更精簡器顯示名稱、 [顯示名稱] 欄位中的輸入您想要針對每個精簡器顯示名稱。To change the refiner display name, in the Display name field, enter the name that you want to be displayed for each refiner.

    在我們的案例中,針對RefinableString04精簡器我們輸入的內容類型In our scenario, for the RefinableString04 refiner, we entered Content Type .

    顯示名稱

    針對所有您可精簡搜尋 managed 屬性重複此步驟。Repeat this step for all your refinable managed properties.

  12. 若要儲存設定,請按一下 [精簡搜尋設定] 對話方塊中的[確定] ,然後在 [網頁組件工具窗格的[確定]To save the configurations, click OK in the Refinement configuration dialog box, and then OK in the Web Part tool pane.

  13. 儲存網頁。Save the page.

我們的案例中的五個精簡器已現在正確顯示搜尋結果頁面上。In our scenario, the five refiners were now correctly displayed on the search results page.

已設定精簡器

但是,有一個小型的詳細資料會讓更好的精簡器。正使用者無法看到精簡器值的數字的詳細資訊。例如,無法看到鎖寫入有的搜尋設定的文章的作者名稱。不過,我們無法看到多少他們有撰寫的文章。But, there was one small detail that would make the refiners even better. Right now users couldn't see numeric details for the refiner values. For example, we could see names of writers that had written articles that had to do with search configuration . However, we couldn't see how many articles they had written.

Bella 作者精簡器

若要查看此資訊,我們需要新增為精簡器值的計數To see this information, we needed to add counts to the refiner values.

如何新增到精簡器值的計數 (英文)How to add counts to refiner values

若要新增計數至精簡器值,您必須編輯顯示範本。當您使用顯示範本時,您將 life 更加容易讓您進行如果您將網路磁碟機對應。執行此動作,您將能夠使用 [Windows 檔案總管的顯示範本。階段 6: 上傳並將新的主版頁面套用到 in SharePoint Server 發佈網站說明如何在網路磁碟機對應。To add counts to refiner values, you'll have to edit a display template. When you work with display templates, you'll make life a lot easier for yourself if you map your network drive. By doing this, you'll be able to work with display templates from Windows Explorer. Stage 6: Upload and apply a new master page to a publishing site in SharePoint Server explains how to map your network drive.

  1. 在對應的網路磁碟機在移至 [顯示範本 --> 篩選器In your mapped network drive, go to Display Templates --> Filters.

  2. 若要新增在才可以同時選取一個精簡器值的精簡器計數,開啟 HTML 檔案Filter_Default。若要新增很可能要選取多個精簡器值的精簡器計數,開啟 HTML 檔案Filter_MultiValueTo add counts to refiners where it's only possible to select one refiner value at a time, open the HTML file Filter_Default. To add counts to refiners where it's possible to select multiple refiner values, open the HTML file Filter_MultiValue.

  3. ShowCounts 的值變更為 trueChange the value for ShowCounts to true.

    顯示計數 True

  4. 儲存檔案。Save the file.

    若要確認有顯示精簡器計數,輸入查詢搜尋中心內。To verify that refiner counts are displayed, enter a query in your search center.

    在我們的案例中,我們再次輸入搜尋設定。我們現在可以看見編寫器"Bella Engen"已在鎖的搜尋組態的某個項目之主旨的五個文章的作者。好 !In our scenario, we again entered search configuration . We could now see that the writer "Bella Engen" was the writer of five articles on the subject that had something to do with search configuration. Nice!

    含計數的精簡器

本系列中的下一篇文章Next article in this series

如何將自訂的搜尋類別新增至 SharePoint Server 中的搜尋結果頁面How to add a custom search vertical to your search results page in SharePoint Server