Sort Processors
When to Use
When you need to control the order of facet result items.
Decision: Sort Processors
| ID | Title | Weight | Default Enabled | Direction Config |
|---|---|---|---|---|
active_widget_order |
Sort by active state | 20 | Yes | ASC = active first |
count_widget_order |
Sort by count | 30 | Yes | DESC = highest count first |
display_value_widget_order |
Sort by display value | 40 | Yes | ASC = alphabetical |
raw_value_widget_order |
Sort by raw value | 50 | No | ASC = lowest first |
term_weight_widget_order |
Sort by taxonomy weight | 60 | No | ASC = lightest first |
Pattern: Sort Order
Processors execute in weight order. Each processor returns a comparison result (-1, 0, 1) for a pair of results. If a processor returns 0 (equal), the next processor in the chain breaks the tie.
Default order (all enabled):
- Active items first (active_widget_order)
- Then by count descending (count_widget_order)
- Then alphabetically (display_value_widget_order)
Pattern: term_weight_widget_order
Uses the taxonomy term's weight field for ordering. This respects the manual ordering set in the taxonomy vocabulary UI. Useful when you want a specific non-alphabetical order.
Common Mistakes
- Conflicting sort processors — If you enable both
count_widget_order(DESC) anddisplay_value_widget_order(ASC), the one with lower weight wins for items with different counts. Items with the same count fall through to the next sorter. - Expecting drag-and-drop sort — Facets doesn't support arbitrary manual ordering. Use
term_weight_widget_orderwith taxonomy weights, or create a custom sort processor.
See Also
- Processing Pipeline — sort stage in the pipeline
- Hierarchy — sorting within hierarchy levels
- Reference:
src/Plugin/facets/processor/