Access Complete Result Set in a Content Search Webpart


While using the Display templates for Content Search Web part, we may need to access the whole result set at once. I faced a similar scenario where I needed the Results as whole and group them based on a Managed Property.

Normally if you open the out of the box Item Template you can see in a number of Places ctx.CurrentItem which gives you access to the current Item and all of its Properties.


As I Mentioned I wanted all the Results not just the Current Item, The below Single Line of code can give you access to that in JSON Format

var Results = ctx.ListData.ResultTables[0].ResultRows;

That’s it and you are good to go and on your way to create great search experience for the Users.

Leave a Reply

Your email address will not be published. Required fields are marked *