Gravatar for loebrandy@gmail.com

Question by rloeb, Mar 31, 2016 1:52 PM

Top Results with rest api and aq filters?

Using rest api (sitecore data if that matters) it seems that TopResults does not respect filters in the aq: parameter which would exclude the topresult.

Example, q: "tom". Some document A is configured as a TopResult for "tom". Works as expected.

But say document A has @myfield=="myval". If I run q: "tom" aq: NOT @myfield=="myval", document A is still returned.

Is this a bug?

Is there some way to have aq: respected? Or at least to know that but for Topresult the document would have been omitted from results?

Thanks!

1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Mar 31, 2016 5:25 PM

Hi Randy,

Coveo Enterprise Search 7 platform top results never respect query filters, not even the ones in the user query. If the user query contains a term that match a top result configuration, the top result is added to the query result set in the first position. Whatever the endpoint you would query, top results will behave the same way.

An alternative to top results, if you have only a few, could be to generate your own query ranking expressions (QRE) and add them to all the queries. That way, the query filters would also be applied as the QRE's job would be only to boost the matching results but wouldn't add the results to the result set if not returned by the index.

I hope this helps,

Jeff

Gravatar for loebrandy@gmail.com

Comment by rloeb, Mar 31, 2016 6:47 PM

Thanks, is there a way to tell if a particular result was boosted by the QRE, i.e. how can you tell if the score is natural or boosted?

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Apr 1, 2016 9:25 AM

The is one when debugging information is enabled on the query. A ranking information property will be filled.

Simpler than that: if you boost by 1,000,000 points, you can use a condition in the UI result template. Natural boosting is rarely higher than 10,000. Most likely in the 1,000-6,000 range.

if (raw.score > 1000000) { ... }
Ask a question