Gravatar for joyceyurh@strateqgrp.com

Question by whyy, Sep 22, 2014 3:21 AM

REST sort criteria

I want to be able to sort by ascending, followed by relevancy. Is that possible?

http://localhost:8082/rest/search?q=@syscollection==abc&sortField=@patno&sortCriteria=[fieldascending, relevancy]

I tried the above but i'm getting error:

scala.MatchError: [fielddescending relevancy] (of class java.lang.String)

1 Reply
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Sep 22, 2014 3:42 AM

Right now it is only possible to sort on a single value (field or relevancy), so passing an array instead of a single value will produce an error.

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Sep 22, 2014 3:47 AM

I tried to make use of the $qrf to achieve what I want to do (as mentioned here: https://answers.coveo.com/questions/394/set-priority-in-sort-criteria), but it returned error:

http://localhost:8082/rest/search?q=@syscollection==UMSC2 $sort(criteria:'fielddescending',field:@patno) $qrf(expression:'@patno* 1000')

Error:"Cannot combine result sets with both ranking functions and query sort orders.",

I can't use $sort and $qrf at the same time?

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Sep 22, 2014 3:48 AM

I tried to make use of the $qrf to achieve what I want to do (as mentioned here: https://answers.coveo.com/questions/394/set-priority-in-sort-criteria), but it returned error:

http://localhost:8082/rest/search?q=@syscollection==abc $sort(criteria:'fielddescending',field:@patno) $qrf(expression:'@patno* 1000')

Error:"Cannot combine result sets with both ranking functions and query sort orders.",

I can't use $sort and $qrf at the same time?

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Sep 22, 2014 12:05 PM

No. Ranking functions act on the relevancy computation… which you can't mix with sorting with fields. Sorry…

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Sep 22, 2014 7:52 PM

Ok. So are there any other options to achieve this? Sort by field, then followed by relevancy?

Ask a question