Gravatar for rvijay@cadence.com

Question by rvijay@cadence.com, May 29, 2018 8:27 PM

Query building is not applied.

I have an issue with my code. Basically, the query filters are not applied to the results

<CoveoV2:JsSearch debug="true" searchHub="NewTroubleshootingInfo" filter="{!UserFilter}" additionalUserIdentities="{!AdditionalUserIdentities}" stylesheet="CoveoFullSearch.css">
    </CoveoV2:JsSearch>
&lt;script&gt;    
    document.addEventListener('DOMContentLoaded', function () {
        var root = document.body;   
        Coveo.$$(root).on('buildingQuery', function(e, args) {
            var builder = new Coveo.QueryBuilder();
            builder.expression.add('innovus');
            builder.advancedExpression.addFieldExpression('@caddoctype', '==', ['Troubleshooting Info', 'Error Message', 'SKILL Information', 'Scripts']);
        });
        Coveo.init(root);
    })
&lt;/script&gt;
&lt;div class="CoveoResultList" data-layout="list" data-auto-select-fields-to-include="false"&gt;&lt;/div&gt;
1 Reply
Gravatar for maveilleux@coveo.com

Answer by maveilleux, May 29, 2018 8:34 PM

Instead of creating a new querybuilder, did you try using the one in the `args`?

Something like, `args.queryBuilder.expression.add('innovus');`

Gravatar for rvijay@cadence.com

Comment by rvijay@cadence.com, May 29, 2018 8:39 PM

How can I add advancedExpression in the same way?

Thanks,

Vijay.

Ask a question