Without falling into the x/y problem area, I'll explain what I want to do: I would like to group my result set by a field, f1 and within each group, I'd like to boost the score of the "most appropriate" member of the group so it appears first in the doc list.

The "most appropriate member" is defined by the content of other fields (e.g., f2, f3). So basically, I'd like to boost based on the values in fields f2 and f3.

If there is a better way to achieve this, I'm all ears. But I was thinking this could be achieved by using a function query as the sortspec to group.sort.

Example content:

<doc>
  <field name="f1">4181770</field> <!-- integer -->
  <field name="f2">x_val</field>   <!-- text -->
  <field name="f3">100</field>     <!-- integer -->
</doc>
<doc>
  <field name="f1">4181770</field>
  <field name="f2">y_val</field>
  <field name="f3">100</field>
</doc>
<doc>
  <field name="f1">4181770</field>
  <field name="f2">z_val</field>
  <field name="f3">100</field>
</doc>

All 3 of the above documents will be grouped into a doclist with groupValue=4181770. My questions is then, How do I make the document with f2=y_val appear first in the doclist. I've been playing with

group.field=f1
group.sort=query({!dismax qf=f2 bq=f2:y_val^100}) asc

... but I'm getting:
org.apache.solr.common.SolrException: Can't determine a Sort Order (asc or desc) in sort spec 'query({!dismax qf=f2 bq=f2:y_val^100.0}) asc', pos=14.

Can anyone point to a some examples of this?

thanks

David

Reply via email to