The reason we don't support @SortableField on a document-id field is only one aspect: we don't allow customizations on this field as we want to make the mapping details of this id something in which Hibernate Search is fully in control of; if people need to index this in various other ways we encourage to add a second field mapping the same property (and assign it a field name). (And sorry for the API not making this clear: we'll work on making this more explicit for 6.0) The most important reason for this is that we need the single Document in the index to be identifieable by a single Term; The primary ID of an entity is of course unique but if the key is composite, there is no guarantee that taking a single attribute this will be unique too; so to allow sorting you will have to re-map the id property in a different way. Rainer Burgstaller can you try something like this?
@Entity
@Indexed
public class Person {
@EmbeddedId
@FieldBridge(impl = PersonPKBridge.class)
@Field(name="myid", bridge = @FieldBridge(impl = SortablePersonPKBridge.class))
private PersonPK id;
|