Skip to content

Commit 6eb2dfb

Browse files
make prefix optional and update vector field args (#63)
This PR makes the `prefix` field optional and an empty string by default, which mirrors the default because of the RediSearch API. It also removes the vector field args for block size and initial cap as these are not user friendly fields.
1 parent 1e97e3c commit 6eb2dfb

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

redisvl/cli/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def delete(self, args: Namespace, drop=False):
9090
"""Delete an index
9191
9292
Usage:
93-
redisvl index delete -i <index_name> | -s <schema_path>
93+
rvl index delete -i <index_name> | -s <schema_path>
9494
"""
9595
index = self._connect_to_index(args)
9696
index.delete(drop=drop)

redisvl/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def _get_key(self, record: Dict[str, Any], key_field: Optional[str] = None) -> s
169169
key = record[key_field] # type: ignore
170170
except KeyError:
171171
raise ValueError(f"Key field {key_field} not found in record {record}")
172-
return f"{self._prefix}:{key}"
172+
return f"{self._prefix}:{key}" if self._prefix else key
173173

174174
@check_connected("_redis_conn")
175175
def info(self) -> Dict[str, Any]:

redisvl/schema.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class BaseVectorField(BaseModel):
6464
algorithm: object = Field(...)
6565
datatype: str = Field(default="FLOAT32")
6666
distance_metric: str = Field(default="COSINE")
67-
initial_cap: int = Field(default=20000)
6867

6968
@validator("algorithm", "datatype", "distance_metric", pre=True, each_item=True)
7069
def uppercase_strings(cls, v):
@@ -73,7 +72,6 @@ def uppercase_strings(cls, v):
7372

7473
class FlatVectorField(BaseVectorField):
7574
algorithm: object = Literal["FLAT"]
76-
block_size: int = Field(default=1000)
7775

7876
def as_field(self):
7977
return VectorField(
@@ -83,8 +81,6 @@ def as_field(self):
8381
"TYPE": self.datatype,
8482
"DIM": self.dims,
8583
"DISTANCE_METRIC": self.distance_metric,
86-
"INITIAL_CAP": self.initial_cap,
87-
"BLOCK_SIZE": self.block_size,
8884
},
8985
)
9086

@@ -104,7 +100,6 @@ def as_field(self):
104100
"TYPE": self.datatype,
105101
"DIM": self.dims,
106102
"DISTANCE_METRIC": self.distance_metric,
107-
"INITIAL_CAP": self.initial_cap,
108103
"M": self.m,
109104
"EF_CONSTRUCTION": self.ef_construction,
110105
"EF_RUNTIME": self.ef_runtime,
@@ -115,7 +110,7 @@ def as_field(self):
115110

116111
class IndexModel(BaseModel):
117112
name: str = Field(...)
118-
prefix: str = Field(...)
113+
prefix: Optional[str] = Field(default="")
119114
storage_type: Optional[str] = Field(default="hash")
120115

121116

0 commit comments

Comments
 (0)