Gravatar for lautaro.bonetto@gmail.com

Question by Lautaro Bonetto, Aug 6, 2014 4:02 PM

queryCorrections data not found

I have the CES and the Front-End Server locally. I want to get the JSON data related to the "DidYouMean" data to use them on other place manually. I guess that those data are coming on the queryCorrections field on the JSON, but they're not coming.

This is the URL that I'm writing manually on the Front-End server. The word "lautaro" doesn't exist on the content that CES has indexed.

http://localhost:8080/Coveo/Rest/?aq=(lautaro)&enableDidYouMean=true

The result is this one:

{
  "totalCount": 0,
  "duration": 12,
  "indexDuration": 10,
  "exception": {
    "code": "1",
    "context": ""
  },
  "queryCorrections": [],
  "groupByResults": [],
  "results": []
}

Did I forget some configuration to see data on queryCorrections?

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, Aug 6, 2014 5:00 PM

If your index contains absolutely no document that are at least closely related to lautaro, then it won't provide queryCorrections.

Try making a small mistake in a word (one letter off), for example instead of the word 'test' , try 'tst' or 'tes' , 'mobil' instead of 'mobile', 'sarch' instead of 'search' etc (trial and error)…

If 'test' would return, let's say, 500 results, but 'tst' return 0 results, then the index will return the corrected query.

Also, it need to use the q parameters instead of aq.

q means 'query', which is what a user would normally put inside the query box.

aq is advanced query, meaning the facet, field filters etc. aq is not generally something that the end user would interact with directly, so the index provide no correction for this.

So for example your query would be :

http://localhost:8080/Coveo/Rest/?q=tst&enableDidYouMean=true

Gravatar for lautaro.bonetto@gmail.com

Comment by Lautaro Bonetto, Aug 6, 2014 5:59 PM

Works. Thanks!

Also, I can combine the "q" parameter with the "aq" parameter. It's because I have to apply more filters on the query.

Example:

This query: http://localhost:8080/Coveo/Rest/?q=sectio&aq=(@syscollection=="TestCollection")&enableDidYouMean=true

"queryCorrections": [ { "correctedQuery": "section", "wordCorrections": [ { "offset": 0, "length": 7, "originalWord": "sectio", "correctedWord": "section" } ] } ],

Gravatar for olamothe@coveo.com

Comment by olamothe, Aug 6, 2014 6:32 PM

Yep, you can combine those no problem.

Don't forget to accept the answer, it helps other people with the same problem finding the solution more easily

Ask a question