Gravatar for lbrahma@coveo.com

Question by Lipika Brahma, Mar 13, 2017 7:29 PM

Escaping special characters in QPL

We're trying to create a rule for the below scenario:

When case product information matches the product information on a KB article , the KB articles gets boosted by 100 points. We're passing the case product information to the context object so here's the rule we've created.

boost `@sfkbdcsoftware contains $context.caseproduct` by 1000 

This works very well and the product gets replaces dynamically. BUT when the product name contains a special character, it does not escape the characters, it processes the query expression but does replace by the product name.

The product name example :

Blue Tool (HD)

Syntax that we tried. 1) Tried adding single quotes "@sfkbdcsoftware contains '$context.caseproduct' 2) Tried adding backslash. "@sfkbdcsoftware contains /'$context.caseproduct/' 3) Tried adding double quotes -- this doesn't work at all and treats the qouted text as the product- so obviously no boost.

What syntax can we use to make sure we escape the special characters in the product name?

1 Reply
Gravatar for fbeaudoin@coveo.com

Answer by Frederic Beaudoin, Mar 14, 2017 8:15 AM

Hi,

Have you tried with the <@- -@> syntax as described in the No Syntax Block topic?

Ask a question