Gravatar for sohelsd@gmail.com

Question by sohel, Mar 2, 2015 9:29 PM

How to enable partial match in javascript ui

I am trying to pull results for "product" when I search for "prod". Trying this but doesn't work:

 <script type="text/javascript">
    Coveo.$(function() {
        Coveo.$('#search').coveoForSitecore('init', CoveoForSitecore.componentsOptions);
        Coveo.$('#search').on('buildingQuery', function(e, data) {
            data.queryBuilder.enablePartialMatch = true;
            data.queryBuilder.partialMatchKeywords = '0';
            data.queryBuilder.partialMatchThreshold = '1';
        });
    });
</script>
1 Reply
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Mar 3, 2015 2:53 AM

Partial Match is a feature where only a subset of the query keywords need to match a document for it to be included. It's not going to "partially match" keywords themselves. For that you need to enable wildcards and search for prod*.

Gravatar for sohelsd@gmail.com

Comment by sohel, Mar 3, 2015 10:11 AM

Thanks, how can I enable wildcards?

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Mar 4, 2015 3:30 AM

There is an option on the QueryBox component: https://developers.coveo.com/display/JsSearch/QueryBox+Component#QueryBoxComponent-enableWildcards

But you still need to manually include the *.

Ask a question