Grouping documents by the function value
Imagine that you would like to group results not by using queries or field contents, but instead you would like to use a value returned by a function query. An example use case can be grouping documents on the basis of their distance from a point. Sounds nice right? Solr allows that and in this recipe, we will see how we can use a simple function query to group results.
In this recipe, we will use the knowledge that we've gained in the Grouping documents by the field value recipe in this chapter. Read the mentioned recipe before we continue.
How to do it...
- Let's start with the following index structure (just add the following fields definition to your
<field name="id" type="string" ...