Uploaded image for project: 'Spring Data Redis'
  1. Spring Data Redis
  2. DATAREDIS-925

Support secondary index for attribute with UUID type



      I have defined a object model such as "person" to include a field "tenant" as UUID type, I want to annotate with "Indexed" so I can query person by tenant

      public class Person implements Serializable {
         String id;
         UUID tenant;
         String email;

      I added two persons by calling PersonRepository.save(person) with the same tenant UUID with different email.

      Then I have following repository that defines two custom queries where first query using tenant (UUID) return empty (I expected two) while second query using email return one person that is expected.

      @Repository public interface PersonRespository extends CrudRepository<Person, String>

      { List<Person> findByTenantAndEmail(UUID tenant, String email); //return empty List<Person> findByEmail(String email);//this one works fine }

      It looks like framework does not index UUID type as I found out through debugging that PathIndexResolver will try to index UUID.mostSigBits  and UUID.leastSigBits.

      I was able to workaround that by handling UUID type handling inside PathIndexResolver#Set<IndexedData> doResolveIndexesFor(..), but that method is private and I have to copy the code block in the extended class. I wonder if you can make the following enhancement:

      1. Support UUID for secondary index inside the framework
      2. or make PathIndexResolver#Set<IndexedData> doResolveIndexesFor(..) method protected instead of private so developer can handle custom object when dealing with secondary index.




            • Assignee:
              cstrobl Christoph Strobl
              bchen819 Ben
              Last updater:
              Oliver Drotbohm
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: