Share via


Customizing filters in SPS2010 Search results page

If you plan to use a Site Column as filter on the Search results page, within Refinement panel, you will see how it’s done. Wondering how it works for Columns of Type "Person or Group" , either single or multi-valued? You need to have a working Search Service Application, a Search Center Site, a Site Collection/ Publishing Portal and a Document Library already in place.

Let's define 2 Site Columns: "Zuständig" and "Fachlich zuständig" of Type "Person or Group" on a SharePoint Site,

o “Zustaendig” -- Type "Person or Group" (New Group -- "CustomSearch") , Enforce unique values- No, Allow multiple selections - No, Choose from : All Users

o “FachlichZustaendig” -- Type "Person or Group" (Group -- "CustomSearch") ,Enforce unique values- No, Allow multiple selections - Yes, Choose from : All Users

add them on a Document Library and use them with adding several items.

 

Then perform a Full Crawl. Once the Crawl is run, the Crawled Properties for these 2 entries are visible in the Search Administration Page under "Crawled Properties" as "ows_Zustaendig(Text)" and "ows_Fachlich_zustaeding(Text)" . Do not worry about the (Text) Type, it's how the System handles the Columns as Crawled Properties.

The Add of Managed Properties is afterwards required: [SearchAdministration | Metadata Properties | New Managed Prop.]

o "Zustaendig" is mapped to "ows_Zustaendig(Text)" , has single value, Includes values from all crawled properties mapped, is being used in Scopes and has following option enabled : "Add managed property to custom results set retrieved on each query. Note: Only the first 2 kilobytes of data is available for display by default"

 

o "FachlichZustaendig" is mapped to "ows_Fachlichzustaeding(Text)" , has multiple values , Includes values from all crawled properties mapped, is being used in Scopes and has following option enabled : "Add managed property to custom results set retrieved on each query. Note: Only the first 2 kilobytes of data is available for display by default"

On the Search page, perform a search according to the Items added in the Document Library. Once results are displayed, the Search Center Site needs to be in Edit mode so that the Refinement Panel can be edited [Filter CategoryDefinition]. You will need to add following section:

<Category LessLinkText="show fewer" MoreLinkText="show more" MappedProperty="zustaendig" ShowMoreLink="True" SortDirectionForMoreFilters="Ascending" SortByForMoreFilters="Name" SortDirection="Descending" SortBy="Frequency" MaxNumberOfFilters="20" NumberOfFiltersToDisplay="4" MetadataThreshold="5"  Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator" Description="Use this filter to restrict results.by a specific zust."  Title="Zustaendig"/>

 

Be aware that the Lowercase restriction on the MappedProperty should not be there any more, as this limitation was removed with SP1.

If you encounter issues with the functionality though, it's worth trying it out on lowercase also. 

 

The "Use Default Configuration" needs to be unchecked. Then once Saving and Exiting the Edit Mode, the newly added property should be available for refinement :

 

If this still does not show-up on page, make sure that you have enough items to display (>5); as per:  https://msdn.microsoft.com/en-us/library/ff625183.aspx Category [Refinement]  

 

In our settings, we used MetadataThreshold="5" , but the value can be accordingly changed, as per own choice.

But what about the Accuracy Index?

This Value is being directly set-up once for the entire Refinement Panel Web-Part and it stands for how many items are considered in the creation of refiners. By default this is set to 50 so that only the first 50 items in your search results will be used to generate refiners.

As per Technet, this has no upper maximum: https://technet.microsoft.com/en-us/library/gg549985.aspxChange what appears in the Refinement Panel Web Part (SharePoint Server 2010)”

 

 

Next, what if you want to add such Property as Refiner in "Advanced Search"?

For this action, the Search Center Site has to be again in Edit Mode, this time the Advanced Search box will be edited: [Properties] and add the following:   

<PropertyDefs>      
<PropertyDef Name="Path" DataType="text" DisplayName="URL"/>    
.      
.     

<PropertyDef Name="FachlichZustaendig" DataType="text" DisplayName="FachlichZustaendig"/>

</PropertyDefs>

 

and in the <AllResults> Section   

<ResultType DisplayName="All Results" Name="default">      
<KeywordQuery/>      
<PropertyRef Name="Author" />  
.      
.

<PropertyRef Name="FachlichZustaendig" />    
</ResultType>

As such, it will get in the refiners list for the Advanced Search.

  

 

For any of the above handling of the managed properties, the special "Person or Group" Type or single-, multi-value does not determine any special setting or limitation in functionality.

 

References:

https://msdn.microsoft.com/en-us/library/ff625183.aspx :: "Category [Refinement]"

https://msdn.microsoft.com/en-us/library/gg685426.aspx :: "Adding a Refiner to the Refinement Panel Web Part"