Gravatar for sathis.k.durairaj@accenture.com

Question by Sathis, Aug 31, 2015 10:36 AM

Ranking function

I am using .net front end REST api to consume the results from CES server. I am trying to use the rankingFunctions to boosts the results into the top for particular keyword.

Below is the query i framed.

http://localhost:8080/Coveo/Rest/?q=(searchtext)&qre=[{"expression":"@customfield==searchtext","modifier":"1000"}]

But the above query doesnot return any results. Seems problem with query formation.

Any one have idea about framing rankingFunctions query?

1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Aug 31, 2015 11:31 AM

I had success with this syntax without double quotes: ?q=searchtext%20$qre(expression:@customfield=searchtext,modifier:1000)

Note that the Coveo .Net Front-End REST endpoint is a very old product that was replaced by the Coveo Search API. It supports only a small subset of the Coveo Search API features. The Coveo Search API product is standalone and can be installed besides a CES index to offer a powerful REST endpoint. If you need a REST endpoint in your projects, you should always use the Coveo Search API even if you need a Coveo .Net Front-End for other uses.

Gravatar for sathis.k.durairaj@accenture.com

Comment by Sathis, Aug 31, 2015 12:34 PM

Thanks for your reply.

But by adding this qre expression into the query is not boosting the result. I am seeing the same result set with qre and without qre expression.

Do you have any idea?

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Aug 31, 2015 12:49 PM

  • Maybe your modifier is not high enough to have an effect in the original ranking of your search results.
  • Maybe your QRE expression is not formed correctly. The == operator you are using means "is exactly". Thus, if you are searching for "searchtext" and you field contains "searchtext something else", it won't match. The = operator is "contains" in the Coveo query syntax.
  • Maybe your Coveo .Net Front-End is too old and doesn't support this syntax. You may add &debug=1 to the query string to see the QRE execution details.
Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Aug 31, 2015 4:13 PM

Also, in your QRE expression, if your "searchtext" contains more than one term, you need to enclose the value in double quotes for the field expression to match correctly: ?q=search%20text%20$qre(expression:@customfield="search%20text",modifier:1000)

Ask a question