Skip to content

Conversation

@klh666
Copy link

@klh666 klh666 commented Oct 13, 2025

What does this PR do?
A brief description of the change being made with this pull request.
As today we do not have this kind of sorting supported in the engine, even though it should be possible to support this implementing a custom collate, trough define an implementation of this https://github.com/orientechnologies/orientdb/blob/develop/core/src/main/java/com/orientechnologies/orient/core/collate/OCollateFactory.java and plugging it in with a resource locator.

In this way you can add that to an existing distribution adding it with a jar.
Motivation
What inspired you to submit this pull request?

Related issues
A list of issues either fixed, containing architectural discussions, otherwise relevant
for this Pull Request.
#10452

Additional Notes
Anything else we should know when reviewing?

Checklist
[] I have run the build using mvn clean package command
[] My unit tests cover both failure and success scenarios

@tglman
Copy link
Member

tglman commented Oct 13, 2025

Hi,

Thanks to submit this, will review it asap.

Copy link
Member

@tglman tglman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you double check this couple of things than is good to merge for me.

}

// 自然字符串比较器实现
private static class NaturalStringComparator implements Comparator<Object> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

Is there any reason for not use directly https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html#naturalOrder--

I do prefer keep a generic implementation that is already battle tested

public void testNaturalSortOrder() {
NaturalStringCollate collate = new NaturalStringCollate();

// 测试基本的自然排序
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not have anybody in our team now that can read this language, the project official comment language is English, so the comments in other languages will be removed on merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants