Version number in Facet naturally sorted
I have a multi-value string field that contains version numbers in this format:
12.0.0 ; 12.0.0 HF1 ; 12.0.0 HF2 ; 12.0.0 HF3 ; 12.0.0 HF4 ; 12.1.0 ; 12.1.0 HF1 ; 12.1.0 HF2 ; 12.1.1 ; 12.1.1 HF1 ; 12.1.1 HF2 ; 12.1.2 ; 12.1.2 HF1 ; 12.1.2 HF2 ; 12.1.3 ; 184.108.40.206 ; 220.127.116.11 ; 18.104.22.168 ; 22.214.171.124 ; 126.96.36.199 ; 188.8.131.52 ; 184.108.40.206
I want to have them displayed in a facet, and sorted naturally (12.3.4 should come before 9.2.5).... sorting alphabetically doesn't work in this case.
Do you have any suggestions on how this can be done?
Multi-value fields in Coveo are always string fields. As you know, sorting strings that contain numerical-like values is a challenge as you must understand the number formats in the strings and build a custom comparison method. The Coveo Facet component does not support custom item comparison methods.
The only solution I see would be to create a special facet component for that field and hardcode the sort order using the `customSort/data-custom-sort` option of the Facet component: https://coveo.github.io/search-ui/components/facet.html#options.customsort
This means having all the possible version numbers listed in this field in the desired order. Seeing your sample version numbers, you seem to have a lot of versions. Performance might be impacted.