mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-25 13:12:39 +00:00
fix: keep FTS indexes in list_indices when their files are missing (#4251)
Fixes #4250 `list_indices()` loads each FTS index's segment params from the index files to fill in `index_details`. That call used `?`, so a single FTS index with missing files made the whole listing fail. A BTree or Bitmap index with missing files still lists fine, because it never takes that path. Now, if the params can't be loaded, it logs a warning and keeps the entry with the details from the manifest. Callers can still see the damaged index and rebuild or drop it. Added a Python test based on the repro in the issue. It fails on 0.39.0 with the same RuntimeError. --------- Co-authored-by: Xuanwo <github@xuanwo.io>
This commit is contained in:
@@ -391,6 +391,20 @@ def test_custom_stop_words_list(table):
|
||||
)
|
||||
|
||||
|
||||
def test_list_indices_with_missing_fts_files(table):
|
||||
# Regression test for https://github.com/lancedb/lancedb/issues/4250
|
||||
table.create_fts_index("text")
|
||||
table.create_scalar_index("id")
|
||||
|
||||
fts = next(i for i in table.list_indices() if i.index_type == "FTS")
|
||||
shutil.rmtree(Path(table.uri) / "_indices" / fts.index_uuid)
|
||||
|
||||
indices = {i.name: i for i in table.list_indices()}
|
||||
assert set(indices) == {"text_idx", "id_idx"}
|
||||
assert indices["text_idx"].index_type == "FTS"
|
||||
assert indices["text_idx"].columns == ["text"]
|
||||
|
||||
|
||||
def test_search_fts(table):
|
||||
table.create_fts_index("text")
|
||||
results = table.search("puppy").select(["id", "text"]).limit(5).to_list()
|
||||
|
||||
Reference in New Issue
Block a user