-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Currently
Currently, we allow something like this:
$builder->add('@field', OrderType::class, ['default' => 'ASC']);This means if you specify
| User input | Final query |
|---|---|
name: foo |
name:foo; @field: ASC |
name: foo; @field: desc |
name:foo; @field: DESC |
Would like
$builder
->add('@id', OrderType::class, ['default' => 'ASC', 'always' => 'append'])
->add('@field', OrderType::class, ['default' => 'ASC']);This means if you specify
| User input | Final query |
|---|---|
name: foo |
name:foo; @field: ASC; @id: ASC |
name: foo; @id: desc |
name:foo; @id: DESC |
name: foo; @field: desc |
name:foo; @field: DESC; @id: ASC |
So
- the fields marked
defaultwould get appended if no user sort is given - the fields marked both
defaultandalwayswould get appended regarless of user input
This allows to stabilize order if you're sorting on a user-controllable property and all the values are the same, Elasticsearch will not keep the same order with each query.
damijank and sstok