Access Complete Result Set in a Content Search Webpart

Hi,

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.

Create a SIngle page application- the easy way

I have been working with AngularJS since few months now, it would have been more if I not for John papa’s Hot Towel Nuget package.

The Nuget package saved so many hours of plumbing work and it works like a dream. I was able to create a Single page app within seconds. Sounds crazy . Not at all. Here’s how you do it.

  • Go to Visual Studio -> Create New Project.
  • Select ASP.NET Web Application. I Chose an Empty template.
  • createempty
  • click ok to create your web app.
  • Here comes the fun part.
  • Search for the following nuget package and install it on your solution.
  • addhtnuget
  • It will install all the required files.
  • installhtnuget
  • And That’s all. Press F5 to access your SPA.
  • spadone

http://www.johnpapa.net/hot-towel-angular/

Deploy Azure Website

There are quite a few ways to deploy your azure website using visual studio , but i find the following the easiest.

  • Create a vanilla website in azure. This is my destination site where I will deploy all my changes

vanillaweb

  • Once you have created a website in azure, try accessing it from your browser.webcreated
  • You should see a welcome page similar to this.
  • accessweb
  • Next step is to make changes and deploy them to your website.
  • Let’s say you have to change the way your website looks like.
  • Create a new asp.net web application using visual studio.
  •  newweb
  • Once you have done your changes and ready to deploy to azure, navigate to https://manage.windowsazure.com
  • Find your web app and click on it to go to the dashboard page.
  • dashboard
  • Click on Download the Publish profile link to download the publishing profile file.
  • pubprofile
  • Move back to Visual Studio and right click on your web application and click on Publish.
  • vspublish1
  • You will find a dialog box like this. Click on Import.
  • importclick
  • Browse to the publish profile file you downloaded from azure and import the file. You should see all the details auto populate in the dialog box as shown below.
  • autopop
  • Click on publish to start the deployment process.
  • pubsuccess
  • Navigate to your website to see the changes deployed.
  • websuccess2
  • Continue this process for continuous deployment from visual studio.