Skip to content

Commit

Permalink
fix: panic if all docs are deleted in a posting list (#3163)
Browse files Browse the repository at this point in the history
  • Loading branch information
BubbleCal authored Nov 25, 2024
1 parent d196ab8 commit 196ec06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions python/python/tests/test_scalar_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,13 @@ def test_fts_with_other_str_scalar_index(dataset):
assert dataset.to_table(full_text_query=query).num_rows > 0


def test_fts_all_deleted(dataset):
dataset.create_scalar_index("doc", index_type="INVERTED", with_position=False)
first_row_doc = dataset.take(indices=[0], columns=["doc"]).column(0)[0].as_py()
dataset.delete(f"doc = '{first_row_doc}'")
dataset.to_table(full_text_query=first_row_doc)


def test_bitmap_index(tmp_path: Path):
"""Test create bitmap index"""
tbl = pa.Table.from_arrays(
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-index/src/scalar/inverted/wand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Wand {
threshold: 0.0,
cur_doc: None,
num_docs,
postings: postings.collect(),
postings: postings.filter(|posting| posting.doc().is_some()).collect(),
candidates: BinaryHeap::new(),
}
}
Expand Down

0 comments on commit 196ec06

Please sign in to comment.