diff --git a/python/lancedb/table.py b/python/lancedb/table.py index 6684f6d7..f0c8107a 100644 --- a/python/lancedb/table.py +++ b/python/lancedb/table.py @@ -595,7 +595,11 @@ class LanceTable(Table): raise ValueError( f"Index already exists. Use replace=True to overwrite." ) - fs.delete_dir(path) + try: + fs.delete_dir(path) + except FileNotFoundError as e: + if "Cannot get information for path" in str(e): + pass index = create_index(self._get_fts_index_path(), field_names) populate_index(index, self, field_names) diff --git a/python/tests/test_fts.py b/python/tests/test_fts.py index 2a61f3ca..51a6c641 100644 --- a/python/tests/test_fts.py +++ b/python/tests/test_fts.py @@ -95,12 +95,12 @@ def test_create_index_from_table(tmp_path, table): ] ) - with pytest.raises(ValueError, match="already exists"): - table.create_fts_index("text") - table.create_fts_index("text", replace=True) assert len(table.search("gorilla").limit(1).to_pandas()) == 1 + with pytest.raises(ValueError, match="already exists"): + table.create_fts_index("text") + def test_create_index_multiple_columns(tmp_path, table): table.create_fts_index(["text", "text2"])