I have a solr collection and I need some calculation done based on data. I have TotalLapTime and DrivingTime , completion rate for a driver is DrivingTime*100/TotalLapTime. I would like to find out average completion time for each team. How can I query the Solr for this ? I have been able only able to get sum of DrivingTime using stats. I am on Solr5
Solr collection:
ID |DrivingTime|TotalLapTime| Team
1 | 50 | 100 | A
2 | 25 | 100 | A
3 | 30 | 60 | B
4 | 50 | 60 | B
5 | 25 | 200 | C
Expected output:
TEAM | AvgCompletionRate
A | 37%
B | 66.5%
C | 12.5%