hbsites

 

Search Refiner Display Template does not show all refiner values

Recently I created a Refiner Display Template to filter a Managed Metadata Term Set. I was wondering that not all refiner values were displayed. The solution was simple: I had to update the maximum number of refiner values in the Refinement WebPart. This article gives some information about the number of refiner values passed to the Refinement WebPart.

When debugging the refiner template, you immediately see one line of code that indicates the cause of the issue:

var listData = ctx.ListData;

ctx.ListData contains all refiner values. The following kind of values are passed to the Refinement WebPart:

  • GTSet
    If you filter the search results by this value, you will get all results for all terms of the term set.
  • GPP
    Valid for internal nodes (terms having a child). Shows all results below this term.
  • GP0
    Valid for internal nodes and leafs. Shows all results for this term.
  • L0
    Valid for internal nodes and leafs.

The default value of the Refinement WebPart is as follows:

MaxRefinerValues

Even if there are only 10 terms in the term set, the default value of 15 in WebPart might not be enough:

  • There is 1 GTSet value.
  • There is 1 GPP value for each internal node, if there are refiner values below.
  • There are 2 values (GP0 and L0) for each refiner value.

If you have 50 values in your term set for example, that have been tagged, the number of returned refiner values will vary between 101 and 150. To be safe set the maximum number of refiner values in your Refinement WebPart to three times of number of terms in your term set.