Skip to content

Commit f8121b2

Browse files
committed
fix: address codex review for PR1 (core)
- Fix CLI step labels to match executor order - Fix GEO coordinates to lat,lon order in integration tests - Move JSON path to top-level field property in tests - Use sys.exit() instead of exit() in CLI - Use transaction=False for quantize pipeline
1 parent db0bb21 commit f8121b2

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

redisvl/cli/migrate.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ def __init__(self):
4242
if not hasattr(self, command):
4343
print(f"Unknown subcommand: {args.command}")
4444
parser.print_help()
45-
exit(1)
45+
sys.exit(1)
4646

4747
try:
4848
getattr(self, command)()
4949
except Exception as e:
5050
logger.error(e)
51-
exit(1)
51+
sys.exit(1)
5252

5353
def helper(self):
5454
parser = argparse.ArgumentParser(
@@ -219,10 +219,10 @@ def _make_progress_callback():
219219
step_labels = {
220220
"enumerate": "[1/8] Enumerate keys",
221221
"bgsave": "[2/8] BGSAVE snapshot",
222-
"drop": "[3/8] Drop index",
223-
"quantize": "[4/8] Quantize vectors",
224-
"field_rename": "[5/8] Rename fields",
225-
"key_rename": "[6/8] Rename keys",
222+
"field_rename": "[3/8] Rename fields",
223+
"drop": "[4/8] Drop index",
224+
"key_rename": "[5/8] Rename keys",
225+
"quantize": "[6/8] Quantize vectors",
226226
"create": "[7/8] Create index",
227227
"index": "[8/8] Re-indexing",
228228
"validate": "Validate",

redisvl/migration/executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ def _quantize_vectors(
10071007

10081008
for i in range(0, remaining_keys, batch_size):
10091009
batch = keys[i : i + batch_size]
1010-
pipe = client.pipeline()
1010+
pipe = client.pipeline(transaction=False)
10111011
undo = BatchUndoBuffer()
10121012
keys_updated_in_batch: set[str] = set()
10131013

tests/integration/test_migration_comprehensive.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def sample_docs():
9393
"description": "First product description",
9494
"category": "electronics",
9595
"price": 99.99,
96-
"location": "-122.4194,37.7749", # SF coordinates
96+
"location": "37.7749,-122.4194", # SF coordinates (lat,lon)
9797
"embedding": array_to_buffer([0.1, 0.2, 0.3, 0.4], "float32"),
9898
},
9999
{
@@ -102,7 +102,7 @@ def sample_docs():
102102
"description": "Second service description",
103103
"category": "software",
104104
"price": 149.99,
105-
"location": "-73.9857,40.7484", # NYC coordinates
105+
"location": "40.7484,-73.9857", # NYC coordinates (lat,lon)
106106
"embedding": array_to_buffer([0.2, 0.3, 0.4, 0.5], "float32"),
107107
},
108108
{
@@ -111,7 +111,7 @@ def sample_docs():
111111
"description": "", # Empty for index_empty tests
112112
"category": "", # Empty for index_empty tests
113113
"price": 0,
114-
"location": "-118.2437,34.0522", # LA coordinates
114+
"location": "34.0522,-118.2437", # LA coordinates (lat,lon)
115115
"embedding": array_to_buffer([0.3, 0.4, 0.5, 0.6], "float32"),
116116
},
117117
]
@@ -1258,15 +1258,15 @@ def json_schema(self, unique_ids):
12581258
"storage_type": "json",
12591259
},
12601260
"fields": [
1261-
{"name": "doc_id", "type": "tag", "attrs": {"path": "$.doc_id"}},
1262-
{"name": "title", "type": "text", "attrs": {"path": "$.title"}},
1263-
{"name": "category", "type": "tag", "attrs": {"path": "$.category"}},
1264-
{"name": "price", "type": "numeric", "attrs": {"path": "$.price"}},
1261+
{"name": "doc_id", "type": "tag", "path": "$.doc_id"},
1262+
{"name": "title", "type": "text", "path": "$.title"},
1263+
{"name": "category", "type": "tag", "path": "$.category"},
1264+
{"name": "price", "type": "numeric", "path": "$.price"},
12651265
{
12661266
"name": "embedding",
12671267
"type": "vector",
1268+
"path": "$.embedding",
12681269
"attrs": {
1269-
"path": "$.embedding",
12701270
"algorithm": "hnsw",
12711271
"dims": 4,
12721272
"distance_metric": "cosine",
@@ -1320,7 +1320,7 @@ def test_json_add_field(
13201320
{
13211321
"name": "status",
13221322
"type": "tag",
1323-
"attrs": {"path": "$.status"},
1323+
"path": "$.status",
13241324
}
13251325
],
13261326
},

0 commit comments

Comments
 (0)