Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.9.2 snapshot #441

Merged
merged 7 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ inherited from the parent poms):
<path>
<groupId>com.redis.om</groupId>
<artifactId>redis-om-spring</artifactId>
<version>0.9.1</version>
<version>0.9.2-SNAPSHOT</version>
</path>
</annotationProcessorPaths>
</configuration>
Expand Down Expand Up @@ -483,7 +483,7 @@ repositories {

```groovy
ext {
redisOmVersion = '0.9.1'
redisOmVersion = '0.9.2-SNAPSHOT'
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions demos/roms-documents/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<dependency>
<groupId>com.redis.om</groupId>
<artifactId>redis-om-spring</artifactId>
<version>0.9.1</version>
<version>0.9.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -147,7 +147,7 @@
<path>
<groupId>com.redis.om</groupId>
<artifactId>redis-om-spring</artifactId>
<version>0.9.1</version>
<version>0.9.2-SNAPSHOT</version>
</path>
</annotationProcessorPaths>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.redis.om.documents;

import com.redis.om.spring.CustomRedisKeyValueTemplate;
import com.redis.om.spring.RediSearchIndexer;
import com.redis.om.spring.indexing.RediSearchIndexer;
import com.redis.om.spring.ops.RedisModulesOperations;
import com.redis.testcontainers.RedisStackContainer;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
2 changes: 1 addition & 1 deletion demos/roms-hashes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>com.redis.om</groupId>
<artifactId>redis-om-spring</artifactId>
<version>0.9.1</version>
<version>0.9.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
2 changes: 1 addition & 1 deletion demos/roms-permits/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<dependency>
<groupId>com.redis.om</groupId>
<artifactId>redis-om-spring</artifactId>
<version>0.9.1</version>
<version>0.9.2-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion demos/roms-vss/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>com.redis.om</groupId>
<artifactId>redis-om-spring</artifactId>
<version>0.9.1</version>
<version>0.9.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.redis.om.vss.domain;

import com.redis.om.spring.DistanceMetric;
import com.redis.om.spring.VectorType;
import com.redis.om.spring.indexing.DistanceMetric;
import com.redis.om.spring.indexing.VectorType;
import com.redis.om.spring.annotations.EmbeddingType;
import com.redis.om.spring.annotations.Indexed;
import com.redis.om.spring.annotations.SchemaFieldType;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.redis.om</groupId>
<artifactId>redis-om-spring-parent</artifactId>
<version>0.9.1</version>
<version>0.9.2-SNAPSHOT</version>
<name>redis-om-spring-parent</name>
<packaging>pom</packaging>

Expand Down
2 changes: 1 addition & 1 deletion redis-om-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>com.redis.om</groupId>
<artifactId>redis-om-spring</artifactId>
<version>0.9.1</version>
<version>0.9.2-SNAPSHOT</version>
<packaging>jar</packaging>

<name>redis-om-spring</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.redis.om.spring.audit.EntityAuditor;
import com.redis.om.spring.convert.MappingRedisOMConverter;
import com.redis.om.spring.convert.RedisOMCustomConversions;
import com.redis.om.spring.indexing.RediSearchIndexer;
import com.redis.om.spring.ops.RedisModulesOperations;
import com.redis.om.spring.ops.search.SearchOperations;
import com.redis.om.spring.vectorize.FeatureExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.gson.reflect.TypeToken;
import com.redis.om.spring.audit.EntityAuditor;
import com.redis.om.spring.convert.RedisOMCustomConversions;
import com.redis.om.spring.indexing.RediSearchIndexer;
import com.redis.om.spring.ops.RedisModulesOperations;
import com.redis.om.spring.ops.json.JSONOperations;
import com.redis.om.spring.ops.search.SearchOperations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.redis.om.spring.annotations.Cuckoo;
import com.redis.om.spring.annotations.Document;
import com.redis.om.spring.client.RedisModulesClient;
import com.redis.om.spring.indexing.RediSearchIndexer;
import com.redis.om.spring.ops.RedisModulesOperations;
import com.redis.om.spring.ops.json.JSONOperations;
import com.redis.om.spring.ops.pds.BloomOperations;
Expand Down Expand Up @@ -60,10 +61,7 @@

import java.io.IOException;
import java.net.InetAddress;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -98,6 +96,7 @@ public GsonBuilder gsonBuilder(List<GsonBuilderCustomizer> customizers) {
builder.registerTypeAdapter(Ulid.class, UlidTypeAdapter.getInstance());
builder.registerTypeAdapter(Instant.class, InstantTypeAdapter.getInstance());
builder.registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeTypeAdapter());
builder.registerTypeAdapter(YearMonth.class, new YearMonthTypeAdapter());

builder.addSerializationExclusionStrategy(GsonReferencesSerializationExclusionStrategy.INSTANCE);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.redis.om.spring.annotations;

import com.redis.om.spring.DistanceMetric;
import com.redis.om.spring.VectorType;
import com.redis.om.spring.indexing.DistanceMetric;
import com.redis.om.spring.indexing.VectorType;
import redis.clients.jedis.search.schemafields.VectorField.VectorAlgorithm;

import java.lang.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.redis.om.spring.annotations;

import com.redis.om.spring.DistanceMetric;
import com.redis.om.spring.VectorType;
import com.redis.om.spring.indexing.DistanceMetric;
import com.redis.om.spring.indexing.VectorType;
import redis.clients.jedis.search.schemafields.VectorField.VectorAlgorithm;

import java.lang.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.redis.om.spring.convert;

import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;

import java.nio.charset.StandardCharsets;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;

@ReadingConverter
public class BytesToYearMonthConverter implements Converter<byte[], YearMonth> {
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");

@Override
public YearMonth convert(byte[] source) {
return formatter.parse(toString(source), YearMonth::from);
}

String toString(byte[] source) {
return new String(source, StandardCharsets.UTF_8);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.redis.om.spring.convert;

import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.WritingConverter;
import org.springframework.stereotype.Component;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;

@Component
@WritingConverter
public class LocalDateTimeToStringConverter implements Converter<LocalDateTime, String> {
@Override
public String convert(LocalDateTime source) {
Instant instant = ZonedDateTime.of(source, ZoneId.systemDefault()).toInstant();
long timeInMillis = instant.toEpochMilli();
return Long.toString(timeInMillis);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ public class RedisOMCustomConversions extends RedisCustomConversions {
// Ulid
omConverters.add(new UlidToBytesConverter());
omConverters.add(new BytesToUlidConverter());

// Point
omConverters.add(new PointToBytesConverter());
omConverters.add(new BytesToPointConverter());

// Date
omConverters.add(new DateToBytesConverter());
omConverters.add(new BytesToDateConverter());
Expand All @@ -25,16 +27,25 @@ public class RedisOMCustomConversions extends RedisCustomConversions {
omConverters.add(new LocalDateToBytesConverter());
omConverters.add(new BytesToLocalDateConverter());
omConverters.add(new LocalDateToStringConverter());

// OffsetDateTime
omConverters.add(new OffsetDateTimeToBytesConverter());
omConverters.add(new BytesToOffsetDateTimeConverter());
omConverters.add(new OffsetDateTimeToStringConverter());

// LocalDateTime
omConverters.add(new LocalDateTimeToBytesConverter());
omConverters.add(new BytesToLocalDateTimeConverter());
omConverters.add(new LocalDateTimeToStringConverter());

// Boolean
omConverters.add(new BooleanToBytesConverter());
omConverters.add(new BytesToBooleanConverter());

// YearMonth
omConverters.add(new YearMonthToBytesConverter());
omConverters.add(new YearMonthToStringConverter());
omConverters.add(new BytesToYearMonthConverter());
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.redis.om.spring.convert;

import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.WritingConverter;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;

@Component
@WritingConverter
public class YearMonthToBytesConverter implements Converter<YearMonth, byte[]> {
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");

byte[] fromString(String source) {
return source.getBytes(StandardCharsets.UTF_8);
}

@Override
public byte[] convert(YearMonth source) {
return fromString(source.format(formatter));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.redis.om.spring.convert;

import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.WritingConverter;
import org.springframework.stereotype.Component;

import java.time.YearMonth;
import java.time.format.DateTimeFormatter;

@Component
@WritingConverter
public class YearMonthToStringConverter implements Converter<YearMonth, String> {
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");

@Override
public String convert(YearMonth source) {
return source.format(formatter);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redis.om.spring;
package com.redis.om.spring.indexing;

public enum DistanceMetric {
L2,
Expand Down
Loading
Loading