Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] apply to specify "always on" sort fields #263

Open
dkarlovi opened this issue Feb 13, 2019 · 0 comments
Open

[Core] apply to specify "always on" sort fields #263

dkarlovi opened this issue Feb 13, 2019 · 0 comments
Milestone

Comments

@dkarlovi
Copy link
Contributor

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 default would get appended if no user sort is given
  • the fields marked both default and always would 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.

@dkarlovi dkarlovi changed the title [Core] apply to specify "always on" search fields [Core] apply to specify "always on" sort fields Feb 13, 2019
@sstok sstok added this to the 2.0 milestone Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants