Vibhav Singh Rohilla
Vibhav Singh Rohilla

Reputation: 768

unable to understand sorting data on query solr

I am trying to understand a solr sort clause I found in Legacy code -

q=*:*
sort=product(if(salesAmount,salesAmount,0.05), query($sortbq)) desc,
sortbq=*:*^10.000 brand:"nike"^1.600
fl=salesAmount,queryVal:query($sortbq)

Sample document in result looks like -

<!-- FOR brand=nike -->
<doc>
<double name="salesAmount">91743.75</double>
<str name="brand">Nike</str>
<float name="queryVal">2.3159266</float>
</doc>
<!-- FOR brand!=nike -->
<doc>
<str name="prdId">1070694</str>
<double name="sls_amt">92660.75</double>
<str name="brand">Lee</str>
<float name="queryVal">0.19959758</float>
</doc>

Can anybody please explain how this query($sortbq)) calculates a single value on which sorting is done? I tried the solr query with debug=true and getting the below values in debug section -

<str name="1139424">
1.0 = *:*, product of: 1.0 = boost 1.0 = queryNorm
</str>
<str name="1011619">
1.0 = *:*, product of: 1.0 = boost 1.0 = queryNorm
</str>

PS : If any one chooses to down-vote this question, please do mention reason in comments.

Upvotes: 1

Views: 66

Answers (1)

Nitendra
Nitendra

Reputation: 494

Please try by putting your sort clause in bq of solr query and put "debug.explain.structured=true" You will find how the sort score is being calculated.

Upvotes: 1

Related Questions