Thursday, March 14, 2013

Refiners in SharePoint 2013 Search

We will try to understand how refiners work in SharePoint 2013 here.

Refiner webpart passes a Jason object in url .

1. Go to view all site content ( http://servername/sites/var/_layouts/15/viewlsts.aspx)

2. Create a Custom List similar to mentioned below :

Column TermSetColumnPOC ( Allow multiple values) is linked to a termset withTerms :

Term1 , Term2 , Term3 , Term4 , Term5 ,Term6 , Term7 , Term8 ,Term9

I want my search result page to display results  when "Term8"  is present in column TermSetColumnPOC or NormalColumnPOC  . I will also provide a filter , which will hide the results which don't have "Term8"  present in column TermSetColumnPOC .

2. Populate data in custom List :

Searching "Term1" should give items hk1 , hk4 , hk7, hk9

Searching "Term8" should give hk1, hk6,hk8

Now applying Refiner on "TermSetColumnPOC" equal to value  "Term8"  should give only hk1,hk8

3. Create a Content Source under Search administration in central admin which contain only your test web application to be crawled . This is not a mandate , but will expedite this process of testing refiners , as you will drastically reduce crawling time.

Run a full crawl on this search content source.

4.   Search Service application > Search Schema

Create a managed property "TermSetColumnPOCManaged" as mentioned below

5. Run full crawl  again.

6. After this crawl is over , you can test refiners in your search center . I don't want one so , I will create my own simple page.

7.  Enable site collection feature "Search Server Web Parts and Templates"

8.  Create a simple web part page and insert below mentioned webpart on page

Search Box , Search results , Refinement

9. Under Webpart properties of refinement  webpart choose TermSetColumnPOCManaged as one of the available refiners.

10 . Publish and approve this page .

11.  Type "Term1"  in search box or Type url   http://......./search1.aspx#k=Term1

11.1 Type "Term8"  in search box or Type url   http://......./search1.aspx#k=Term8

11.2 Type "Term8"  in search box and Click on "Term8"   in Refiners

( use url decode to understand what is being passed in url )



( here equivalent json object is passed as parameter )



( here equivalent json object is passed as parameter  but with Term display value )

11.3 search "TermSetColumnPOCManaged:Term8"  or 

type url  http://......./search1.aspx#k=TermSetColumnPOCManaged:Term8

Another example of JASON with Refiners and Search core result webpart :

On the same page Search "Term1" , and in Refiners , select "Term1"

or type url :


The result in both ways :

One more example of jason with Search result page :

On the same page Search "Term1" , and in Refiners , select "Term9"

or type url :


Result both ways comes to be :

You may also like:

SharePoint 2013 features overview