Redis store: add default index and prefix values for auto-conf

This commit is contained in:
Christian Tzolov
2024-04-12 08:14:59 +02:00
parent b82dd98985
commit c7512a00a7
3 changed files with 11 additions and 11 deletions

View File

@@ -63,7 +63,7 @@ A simple configuration can either be provided via Spring Boot's _application.pro
[source,properties]
----
spring.ai.vectorstore.redis.uri=<host of your redis instance>
spring.ai.vectorstore.redis.uri=<your redis instance uri>
spring.ai.vectorstore.redis.index=<your index name>
spring.ai.vectorstore.redis.prefix=<your prefix>
@@ -100,9 +100,9 @@ You can use the following properties in your Spring Boot configuration to custom
|===
|Property| Description | Default value
|`spring.ai.vectorstore.redis.uri`| Server connection URI | redis://localhost:6379
|`spring.ai.vectorstore.redis.index`| Index name (REQUIRED) | -
|`spring.ai.vectorstore.redis.prefix`| (REQUIRED) | -
|`spring.ai.vectorstore.redis.uri`| Server connection URI | `redis://localhost:6379`
|`spring.ai.vectorstore.redis.index`| Index name | `default-index`
|`spring.ai.vectorstore.redis.prefix`| Prefix | `default:`
|===

View File

@@ -27,12 +27,12 @@ public class RedisVectorStoreProperties {
private String uri = "redis://localhost:6379";
private String index;
private String index = "default-index";
private String prefix;
private String prefix = "default:";
public String getUri() {
return uri;
return this.uri;
}
public void setUri(String uri) {
@@ -40,7 +40,7 @@ public class RedisVectorStoreProperties {
}
public String getIndex() {
return index;
return this.index;
}
public void setIndex(String name) {
@@ -48,7 +48,7 @@ public class RedisVectorStoreProperties {
}
public String getPrefix() {
return prefix;
return this.prefix;
}
public void setPrefix(String prefix) {

View File

@@ -28,8 +28,8 @@ class RedisVectorStorePropertiesTests {
void defaultValues() {
var props = new RedisVectorStoreProperties();
assertThat(props.getUri()).isEqualTo("redis://localhost:6379");
assertThat(props.getIndex()).isNull();
assertThat(props.getPrefix()).isNull();
assertThat(props.getIndex()).isEqualTo("default-index");
assertThat(props.getPrefix()).isEqualTo("default:");
}
@Test