Skip to content

Commit

Permalink
Prefix option added in ftCreate command
Browse files Browse the repository at this point in the history
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
  • Loading branch information
prateek-kumar-improving committed Sep 27, 2024
1 parent cfa2ce3 commit d25ecc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,23 @@ class FtCreateOptions:
def __init__(
self,
dataType: Optional[DataType],
prefixes: Optional[List[str]],
fields: List[FieldInfo],
):
self.dataType = dataType
self.prefixes = prefixes
self.fields = fields

def getCreateOptions(self) -> List[str]:
args = []
if self.dataType:
args.append("ON")
args.append(self.dataType.name)
if self.prefixes:
args.append("PREFIX")
args.append(str(len(self.prefixes)))
for prefix in self.prefixes:
args.append(prefix)
if self.fields:
args.append("SCHEMA")
for fieldInfo in self.fields:
Expand Down
7 changes: 5 additions & 2 deletions python/python/tests/tests_server_modules/test_vss.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ async def test_vss_create(self, glide_client: TGlideClient):
fields.append(fieldInfo1)
fields.append(fieldInfo2)
fields.append(fieldInfo3)
options: FtCreateOptions = FtCreateOptions(DataType.HASH, fields)

prefixes: List[str] = []
prefixes.append("blog:post:")
options: FtCreateOptions = FtCreateOptions(DataType.HASH, prefixes, fields)
result = await vss.create(glide_client, index, options)
assert result == OK

# print info command result
print(await vss.info(glide_client, index))

0 comments on commit d25ecc5

Please sign in to comment.