Hi,

On Thu, Sep 24, 2015 at 09:23:20AM +0200, Gunnar Morling wrote:
> Either way, you should mark the field to sort on with @SortableField
> which will cause that field to get indexed as doc value field, making
> sorting much faster (see [1] and [2] for the details):
> 
>     @Id
>     @NumericField
>     @SortableField
>     private Long id;

To expand on this - you should not make any assumptions on the id field
or use it for indexing etc. We talked for a long time that we want to prevent
users to use the internal Search document id in queries and for sorting.
This would allow for optimizations of how for example the id is stored and
encoded.

If you need the id value for searches and/or sorting you should use additional
@Field annotations (using @Fields if you need more than one field). So in your 
case you would for example add @Field(name="id_sort", ...). This is the most
future proof solution. 

I don't think that just adding @NumericField will do, since it is just a 
companion
annotation to @Field.

--Hardy

Attachment: pgp92ON5rvnCD.pgp
Description: PGP signature

_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to