You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by hossein nasr esfahani <ho...@gmail.com> on 2018/07/11 06:53:26 UTC

Solr facet division of 2 aggregation function

I'm storing 2 type of data for each record in my Solr core. first one is
the total number of tasks in each day (total) and the second one is the
total number of *finished* tasks in each day (finished). I want to compute
how many percents of tasks was finished in each *month* using solr json
facet query. Something like this:

{
  finishedRate : {
    type : range,
    field : date,
    gap : "+1MONTH"
    facet: "div(sum(finished),sum(total))"
  }
}

but it said

org.apache.solr.search.SyntaxError: Unknown aggregation agg_div

I test the following query to solve SyntaxError, but it gives me the
maximum percentage of tasks that finished in a day for each month:

{
  finishedRate : {
    type : range,
    field : date,
    gap : "+1MONTH"
    facet: "max(div(sum(finished),sum(total)))"
  }
}

how can I implement this query?

(Just copy my question StackOverflow
<https://stackoverflow.com/questions/51231416/solr-facet-division-of-2-aggregation-function>
 )