Skip to content

Order Mode not set correctly through constructor #2897

Closed
@oraum

Description

@oraum

Hi,

I recently stumbled upon an unexpected behavior when trying to sort a query response using org.springframework.data.elasticsearch.core.query.Order.

Creating a new order like new Order(Sort.Direction.DESC, "somefield", Mode.min); results in mode being null instead of Min.min.

When looking at the other constructors I could trace the error down to line 72 where null is passed instead of mode:

public Order(Sort.Direction direction, String property, Sort.NullHandling nullHandlingHint, @Nullable Mode mode,
	@Nullable String unmappedType) {
this(direction, property, nullHandlingHint, null, unmappedType, null); // <-- instead of this(direction, property, nullHandlingHint, mode, unmappedType, null);
}

This should be trivial to fix - I could provide a pull request if you're interested.
Otherwise if this behavior is intended, a little note would be helpful :)

thanks and best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions