Sorting by numeric value has an exception "(expected=NUMERIC). Use UninvertingReader or index with docvalues"

Description

If I use a field definition where the value is of type "Double". When I try to sort through this field, I get the "(expected=NUMERIC). Use UninvertingReader or index with docvalues" exception.

{{@Indexed
public class Assortment
@Id
@DocumentId
@Column(name = "Id", length = 128)
private String id;
........
@OneToMany(mappedBy = "assortment", orphanRemoval = true, fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@IndexedEmbedded(includeEmbeddedObjectId = true)
private List<AssortmentPrice> prices = new ArrayList<>();
.......
}

public class AssortmentPrice implements Serializable {

@Id
@DocumentId
@Column(name = "Id", length = 128)
private String id;
.........
@Column(name = "BruttoPrice")
@SortableField(forField = "bruttoPrice_sort")
@NumericField(forField = "bruttoPrice_sort", precisionStep = 2)
@Field(name = "bruttoPrice_sort", analyze = Analyze.NO)
private Double bruttoPrice;
.......
}

Sort sort = new Sort(new SortField("prices.bruttoPrice_sort", SortField.Type.DOUBLE));
fullTextQuery.setSort(sort);

}}

Environment

WildFly Application Server 18.1

Assignee

Waldemar Kłaczyński

Reporter

Waldemar Kłaczyński

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Affects versions

Priority

Major
Configure