0

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.

1

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

|improve this answer|||||
  • I've thought about this, but this would mean that I'd have to add this column to every list/library in my site that I want crawled. – Katie Mar 11 '16 at 22:05
  • Added another method which you can use with very little tweaking of code. – Unnie Mar 11 '16 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.