Вопрос

Is it possible to create a refiner on the site search based on the first letter of the title of an item?

My end goal is to be able to display everything in the search results and filter by the letter it begins with like some kind of A-Z index.

Let me know if there's a better way of doing this too.

Это было полезно?

Решение

Method 1:

Create an extra calculated column which will just store the first letter of the Title column.

LEFT([Title],1)

Map the crawled property of this new column to any existing RefinableString managed property and use it as refiner in the Search results page

Method 2:

Create a new custom refinement template by copying and editing the Filter_default template ,which will display only the first letter of the property.

1.Get the first character.

var refChar=refinementName.charAt(0);

2.Change the code to display refChar instead of refinementName .

<div id='RefinementName' class='_#= nameClass =#_'> _#= $htmlEncode(refChar) =#_ </div>

Add a refiner for Title property and use this refinement template

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top