Random access with filter (in Python) #3460
-
Hi, Are there better ways of doing this? I can create a lance index on the tag column, but I can't find the Python API to access the index to accommodate this use-case. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There are no better ways available in the current code. If you create a bitmap index on the tag column we are essentially creating the exact same lookup you describe (a map from every tag to a list of row ids) but there are no APIs in place today to access the index values directly. So the best you can do, once you create the index, is to first query for all matching row ids ( |
Beta Was this translation helpful? Give feedback.
There are no better ways available in the current code. If you create a bitmap index on the tag column we are essentially creating the exact same lookup you describe (a map from every tag to a list of row ids) but there are no APIs in place today to access the index values directly.
So the best you can do, once you create the index, is to first query for all matching row ids (
filter="tag=X", with_row_id=True
) and then sample from the set of row ids that you get back and call_take_rows
.