Simple Grouping Example
Say that you are sporting gear retailer. Spring is coming and you want to find out what kind of bike merchandise you have in stock.
Without using any grouping, here are the results for a query on bike
:
Hit rank in results |
Name |
Quantity |
Warehouse distance (km) |
---|---|---|---|
1 |
Bike |
10 |
100 |
2 |
Bike helmet |
100 |
1 |
3 |
Bike seat |
50 |
12 |
4 |
Bike shoes |
20 |
28 |
5 |
Biking jersey |
500 |
5 |
You want to reduce this list by grouping the results on which the quantity is higher than
50. To do so, define a group where quantity > 50
.
How Many Search Results Do You Have?
Two, because defining a group creates 2 groups:
-
More than 50:
Bike helmet
,Biking jersey
-
50 or fewer (the "other" group):
Bike
,Bike seat
,Bike shoes
.
Which hits Do Display for the Group?
This is defined by:
-
The number of hits to represent the group. Let us keep the default, 1. This means that 2 hits are displayed in the search results, one for each group.
-
The sorting expression for the group. In our example, you want to know what's close by, so let us sort on the distance field in ascending order. This means the hit with the lowest distance value in the group represents the group.
In the grouped search results, this returns:
-
One hit from More than 50,
Biking helmet
(becausedistance
= 1 km, less than forBiking jersey
). -
One hit from 50 or fewer,
Bike seat
(becausedistance
= 12 km, less than forBike
orBike shoes
).
Which Group Displays First in the Search Results?
The group sorting determines which hit represents the group. But ultimately it is the representative hit's relevance score before grouping that determines the group’s rank (display order) in the search results.
In this case, Bike seat
ranked higher than Biking
jersey
before grouping. So the grouped results look like this:
Grouped hit rank |
Name |
Quantity |
Warehouse distance (km) |
---|---|---|---|
1 |
Bike seat |
50 |
1 km |
2 |
Biking jersey |
500 |
5 km |