Gravatar for

Question by jkearns, Jan 12, 2015 6:06 PM

How to apply boosting to Sitecore predicate builder

I have a custom search page using predicate builder. By default, my results do not appear to be using boost values as defined in Sitecore and I would like them to. I am looking at this guide as an example. My code looks very similar to the first example in that guide: results = queryable.CoveoBoost(item => item.TemplateId == new ID(IDstring), 200).ToList();

When I load the site I get the error "Unsupported expression node type: MemberAccess within type constructor parameter." The queryable variable does not seem to be the problem, as I can use it without issue without that boost statement, and using statements like skip and take. The queryable is formed using the Sitecore PredicateBuilder class.

I am also looking at this stack overflow post and it seems to suggest that I might need to add a condition to the predicate instead of applying the boost right to the queryable. Can anyone point out where I'm going wrong here?

1 Reply
Gravatar for

Answer by Vincent Séguin, Jan 13, 2015 7:40 AM

Hi Jesse,

The "CoveoBoost" extension will use Coveo's boosting, which is different from the boosting values in Sitecore. Open the Coveo.SearchProvider.config file and look for the node EnableSitecoreBoosting. Depending on the version on which you are, it should be defined normally under the node. If it's not there, add it this way :

< EnableSitecoreBoosting > true < /EnableSitecoreBoosting >
Ask a question