feat: allow prefiltering with index (#610)

Support for prefiltering with an index was added in lance version 0.8.7.
We can remove the lancedb check that prevents this. Closes #261
This commit is contained in:
Weston Pace
2023-10-31 13:11:03 -07:00
committed by GitHub
parent 6fb539b5bf
commit b517134309
2 changed files with 24 additions and 6 deletions

View File

@@ -287,3 +287,27 @@ def test_replace_index(tmp_path):
num_sub_vectors=4,
replace=True,
)
def test_prefilter_with_index(tmp_path):
db = lancedb.connect(uri=tmp_path)
data = [
{"vector": np.random.rand(128), "item": "foo", "price": float(i)}
for i in range(1000)
]
sample_key = data[100]["vector"]
table = db.create_table(
"test",
data,
)
table.create_index(
num_partitions=2,
num_sub_vectors=4,
)
table = (
table.search(sample_key)
.where("price == 500", prefilter=True)
.limit(5)
.to_arrow()
)
assert table.num_rows == 1