Skip to content

Allow function calls in Sort / Pageable objects in custom queries. #2273

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

Closed
pelletier197 opened this issue May 31, 2021 · 1 comment
Closed
Assignees
Labels
type: enhancement A general enhancement

Comments

@pelletier197
Copy link

pelletier197 commented May 31, 2021

Hello!

Is there a recommended way to sort on computed fields? For instance, in my application, I want to sort by ignoring the diacritics (é, è, à, etc..). To do so, I use apoc.text.clean(department.name) with a custom query and a Pageable. This used to work in spring-data-neo4j 5, but doesn't work anymore.

: Cannot handle order property `apoc.text.clean(department.name)`, it must be a simple property or one-hop path.

The pageable I use is the following..

PageRequest.of(0, 10, Sort.by("apoc.text.clean(department.name)"))

Thank you!

@pelletier197 pelletier197 changed the title Sorting on computed fields Sorting on computed fields in custom queries May 31, 2021
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 1, 2021
@michael-simons michael-simons self-assigned this Jun 1, 2021
@michael-simons michael-simons added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 1, 2021
@michael-simons
Copy link
Collaborator

We don't see any reasons not to support this for custom queries. Custom queries must be used with discretion anyway to avoid Cypher injection, so we decided to lift those restrictions, allowing function calls in sorts.

@michael-simons michael-simons added this to the 6.0.10 (2020.0.10) milestone Jun 1, 2021
@michael-simons michael-simons changed the title Sorting on computed fields in custom queries Allow function calls in Sort / Pageable objects in custom queries. Jun 1, 2021
michael-simons added a commit that referenced this issue Jun 1, 2021
michael-simons added a commit that referenced this issue Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants