Gravatar for

Question by Diego, Mar 16, 2015 3:36 PM

wildcard expression issue with Coveo for Sitecore


I'm searching for a query on the admin tool like this: c*a

When I do this I get the following message(which is correct): Not enough leading characters for the wildcard expression 'c*a'. Specify at least 2 leading characters.

That's fine but the same behavior doesn't happen when I search for the same string on Coveo for Sitecore although I enabled wildcards:

<div class="CoveoSearchBox global-search-form" data-enable-wildcards="true" data-activate-omnibox="<%= Model.ActivateOmniBox %>"></div>

Any ideas which property should I change or what I need to do to reproduce the same behavior? thanks

3 Replies
Gravatar for

Answer by Diego, Mar 27, 2015 3:06 PM

I fixed it getting the results like this and showing a div with a proper message:

        Coveo.$("#search").on("querySuccess", function(a,b){

            if(b.results.exception != null){
                if(b.results.exception.code == "NotEnoughLeadingCharsWildcard"){
Gravatar for

Answer by Jean-François L'Heureux, Mar 16, 2015 6:14 PM

The Administration Tool Index Browser is built using the Coveo .Net Front-End technology while Coveo for Sitecore search interfaces are built using the Coveo JavaScript Framework. These 2 search interface frameworks are completely different and do not support the same features.

The error message is probably returned in the REST call response but it may not be displayed. You can build your own component to display it if you want.

Gravatar for

Comment by Diego, Mar 17, 2015 12:18 PM

Thank you I did try on the rest call but couldn´t identify which jason tags would indicate that. Any ideas on what that could be? thanks

Gravatar for

Comment by Jean-François L'Heureux, Mar 17, 2015 1:26 PM

On my Coveo for Sitecore installation, I have the message "Your query has an error: Not enough leading character wildcard." when I try your query.

Which version/revision of Coveo for Sitecore, Coveo Search API and Coveo Enterprise Search do you use?

Gravatar for

Comment by Diego, Mar 17, 2015 2:04 PM

Sitecore.NET 7.2 (rev. 140526) Coveo for Sitecore 7.2 3.0.807 Coveo Enterprise Search 7(do you need more specific? if so where should I look?) Coveo Search API 8(need more specific? if so where should I look?)

Gravatar for

Comment by Jean-François L'Heureux, Mar 17, 2015 7:49 PM

The Coveo JavaScript Search Framework engineers say that this feature/message was there far before your build version.

Do you use the Coveo for Sitecore out-of-the-box search interface UI components or built your own search interface UI on top of the REST API or the LINQ provider? On this Sitecore instance, did you ever had an older version of Coveo for Sitecore that called an old REST API?

If you look at the network tab of your browser developer tools while clicking on your search page search button, what is the URL of the REST page called? Which files are in your Website/Coveo/rest folder?

Gravatar for

Comment by Diego, Mar 18, 2015 10:42 AM

how should the url look like:

this is how I'm trying:*a Also which JSON property should I be looking into to see whether the error when this happened?

Gravatar for

Comment by Diego, Mar 18, 2015 5:27 PM

any ideias?

Gravatar for

Comment by Jean-François L'Heureux, Mar 19, 2015 9:46 AM

Your URL seems to be good. Can you answer my other questions please. It will greatly help me to help you.

The REST call for the c*a query should return an HTTP 200 JSON object response. The JSON object should contains an "exception" property like this:

exception: { code: "NotEnoughLeadingCharsWildcard", context: "c*a" }
Gravatar for

Answer by Diego, Mar 19, 2015 6:27 PM

Hi so I inspected the request on the network tab and saw that one of the calls was made to: Although if I open the url as you mentioned I don´t see on the output the exception.

On the response of this call(on the browser) I see the exception as you mentioned. The Website/Coveo/rest has only a web.config file. Do you need any info from it?

Also this is out of the box coveo for sitecore and no I didn´t have any other coveo instance prior to this. How can I capture that response using the js framework? do you have an example?

thank you again :)

Ask a question