Friday, 7 November 2014

SharePoint Search result Refinement count using search API

Using below api we can get search result refinement count.

I am search for Bill Gates, and file type is based on my requirement...
You can find below...

https://SPO/search/_api/search/query?querytext='Bill Gates'&refiners='filetype'&refinementfilters='filetype:equals("pptx")'

<d:RefinementCount m:type="Edm.Int64">43373</d:RefinementCount>

https://SPO/search/_api/search/query?querytext='Bill Gates'&refiners='filetype'&refinementfilters='filetype:equals("docx")'

<d:RefinementCount m:type="Edm.Int64">32977</d:RefinementCount>

https://SPO/search/_api/search/query?querytext='Bill Gates'&refiners='filetype'&refinementfilters='filetype:equals("msg")'

<d:RefinementCount m:type="Edm.Int64">14322</d:RefinementCount>

https://SPO/search/_api/search/query?querytext='Bill Gates'&refiners='filetype'&refinementfilters='filetype:equals("pdf")'

<d:RefinementCount m:type="Edm.Int64">6602</d:RefinementCount>

https://SPO/search/_api/search/query?querytext='Bill Gates'&refiners='filetype'&refinementfilters='filetype:equals("html")'

<d:RefinementCount m:type="Edm.Int64">19587</d:RefinementCount>

https://SPO/search/_api/search/query?querytext='Bill Gates'&refiners='filetype'&refinementfilters='filetype:equals("zip")'

<d:RefinementCount m:type="Edm.Int64">2219</d:RefinementCount>