From 477a49cecb2704f12bb26dfe3bb1af2314cadc1c Mon Sep 17 00:00:00 2001 From: ChilePiquin Date: Thu, 3 Sep 2026 15:52:46 -0700 Subject: [PATCH] test: update create-index default contract coverage --- docs/src/js/interfaces/IndexOptions.md | 2 +- python/python/tests/test_remote_db.py | 2 +- rust/lancedb/src/remote/table.rs | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/src/js/interfaces/IndexOptions.md b/docs/src/js/interfaces/IndexOptions.md index 82764601d..815185ae4 100644 --- a/docs/src/js/interfaces/IndexOptions.md +++ b/docs/src/js/interfaces/IndexOptions.md @@ -50,7 +50,7 @@ If this is false, and another index already exists on the same columns and the same name, then an error will be returned. This is true even if that index is out of date. -The default is true +The default is false *** diff --git a/python/python/tests/test_remote_db.py b/python/python/tests/test_remote_db.py index add995de1..850d26bcd 100644 --- a/python/python/tests/test_remote_db.py +++ b/python/python/tests/test_remote_db.py @@ -834,7 +834,7 @@ def test_table_create_indices(): vector_req = received_requests[2] assert "name" in vector_req assert vector_req["name"] == "custom_vector_idx" - assert "replace" not in vector_req + assert vector_req["replace"] is False table.wait_for_index(["custom_scalar_idx"], timedelta(seconds=2)) table.wait_for_index( diff --git a/rust/lancedb/src/remote/table.rs b/rust/lancedb/src/remote/table.rs index f126bb8b7..8e518160c 100644 --- a/rust/lancedb/src/remote/table.rs +++ b/rust/lancedb/src/remote/table.rs @@ -6306,6 +6306,7 @@ mod tests { let mut expected_body = expected_body.clone(); expected_body["column"] = "a".into(); expected_body[INDEX_TYPE_KEY] = index_type.into(); + expected_body["replace"] = false.into(); assert_eq!(body, expected_body); @@ -6615,38 +6616,46 @@ mod tests { json!({ "column": "rowId", "index_type": "BTREE", + "replace": false, }), json!({ "column": "`row-id`", "index_type": "BTREE", + "replace": false, }), json!({ "column": "userId", "index_type": "BTREE", + "replace": false, }), json!({ "column": "MetaData.userId", "index_type": "BTREE", + "replace": false, }), json!({ "column": "metadata.user_id", "index_type": "BTREE", + "replace": false, }), json!({ "column": "image.embedding", "index_type": "IVF_PQ", "metric_type": "l2", + "replace": false, }), { let mut body = serde_json::to_value(InvertedIndexParams::default()).unwrap(); body["column"] = "payload.text".into(); body["index_type"] = "FTS".into(); + body["replace"] = false.into(); body }, { let mut body = serde_json::to_value(InvertedIndexParams::default()).unwrap(); body["column"] = "docs.content".into(); body["index_type"] = "FTS".into(); + body["replace"] = false.into(); body }, { @@ -6654,15 +6663,18 @@ mod tests { body["column"] = "docs.content".into(); body["index_type"] = "FTS".into(); body["document_granularity"] = "list_element".into(); + body["replace"] = false.into(); body }, json!({ "column": "`meta-data`.`user-id`", "index_type": "BTREE", + "replace": false, }), json!({ "column": "literal.`a.b`", "index_type": "BTREE", + "replace": false, }), ]); let request_idx = Arc::new(AtomicUsize::new(0));