If you use the Query tag from the SmartTarget taglib then duplicate results across promotions are removed, (if the AllowDuplicates config in smarttarget_conf.xml is set to false). Using the QueryBuilder API I do not see this happening - I get duplicate results.

Do I need to build my own de-duplication logic on the ResultSet returned from the QueryBuilder, or is this implemented somewhere else in the API that I have missed?

2 Answers 2


Make sure you are calling the ResultSet.FilterPromotions method to filter the Promotions per region after you retrieve the results using the QueryBuilder. Other than the method signature may suggest this method is not only applicable to Experiments, but is also required to post-process returned Promotions. Post-processing the results by calling this method is imperative for the API to, for example, set the correct visible status of Promotions, cookie handling of Experiments and it handles duplicates as well.

Note the method takes a list of promotions items already on the page and a boolean for allowing duplicates on the page. You are responsible for populating this boolean with a value from your own region configuration -OR- the default configuration value from the smarttarget_conf.xml file by passing the value of the ConfigurationUtility.DefaultAllowDuplicates property.

  • That's exactly right. Jeroen knows what's up :) Jul 23, 2015 at 8:52
  • In the Java API (it may be different in .NET) its a static method: com.tridion.smarttarget.query.ResultSetImpl.filterPromotions()
    – Will Price
    Aug 17, 2015 at 13:46

When I last wrote anything against the QueryBuilder API I noticed how "barebone" it really was so your finding is very much in line with my own experience.

As an example: you have to wire up your own ADF claims as triggers in the queries.

The taglibs aren't just syntactic sugar, they actually implement functionality which you'll have to reimplement (or drop) using the QueryBuilder API.

  • 1
    In the lastest version (2014 SP1) There is an AmbientDataHelper that does the mapping of ADF claims to trigger values, so I think things have improved a bit.
    – Will Price
    Jul 22, 2015 at 6:51
  • I found that the API behaves like the taglibs as long as the two step process is used; first execute the QueryBuilder to retrieve the results and secondly filter the results using the ResultSet.FilterPromotions method. The latter is often forgotten! Jul 22, 2015 at 15:01
  • The AmbientDataHelper class has been around for a while (it's what the tags and controls use). You can pass the triggers you get from it to the Parse method of the QueryBuilder to add the triggers to the query. Jul 23, 2015 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.