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

Ordering by fformatter field. #807

Merged
merged 4 commits into from
Apr 9, 2024
Merged

Ordering by fformatter field. #807

merged 4 commits into from
Apr 9, 2024

Conversation

wlorenzetti
Copy link
Member

@wlorenzetti wlorenzetti commented Apr 9, 2024

Closes: #806

Apply the orderign URl parameter on field set by fformatter parameter.

Without ordering parameter:

http://localhost:8006/vector/api/data/qdjango/336/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/?fformatter=address&format=json
  "data": [
    [ "A101",  "Via Sallustio Bandini" ],
    [ "A102",   "Via Atto Vannucci" ],
    [ "A103",   "Via Alfredo Oriani gia' Via Vecchia" ],
    [ "A106",   "Piazza Pietro Leopoldo" ],
    [ "A107",   "Via Ubaldo Montelatici" ],
    [ "A108",   "Via Giandomenico Romagnosi" ],
    [ "B002",  "Via Giovanni Lampredi" ]
]

With ordering parameter (ordering=address):

http://localhost:8006/vector/api/data/qdjango/336/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/?fformatter=address&format=json&ordering=address

"data": [
    [ "A106",  "Piazza Pietro Leopoldo" ],
    [ "A103",  "Via Alfredo Oriani gia' Via Vecchia" ],
    [ "A102",  "Via Atto Vannucci" ],
    [ "A108",  "Via Giandomenico Romagnosi" ],
    [ "B002",  "Via Giovanni Lampredi" ],
    [ "A101",  "Via Sallustio Bandini" ],
    [ "A107",  "Via Ubaldo Montelatici" ]
  ]

Also works with - i.e. ordering=-address fro reversing results.

IMPORTANT

The sorting of results is made by str.sort() python function

@wlorenzetti wlorenzetti added the feature New feature or request label Apr 9, 2024
@wlorenzetti wlorenzetti added this to the v3.8 milestone Apr 9, 2024
@wlorenzetti wlorenzetti requested a review from Raruto April 9, 2024 08:48
@wlorenzetti wlorenzetti self-assigned this Apr 9, 2024
@Raruto Raruto marked this pull request as ready for review April 9, 2024 10:37
@wlorenzetti wlorenzetti merged commit a3b5636 into dev Apr 9, 2024
4 checks passed
@wlorenzetti wlorenzetti deleted the ordering_fformatter branch April 9, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort formatted values in vector API response (ordering + fformatter params)
2 participants