diff --git a/python/lancedb/query.py b/python/lancedb/query.py index 71c18134..f8162efc 100644 --- a/python/lancedb/query.py +++ b/python/lancedb/query.py @@ -226,13 +226,20 @@ class LanceQueryBuilder(ABC): self._columns = columns return self - def where(self, where) -> LanceQueryBuilder: + def where(self, where: str, prefilter: bool = False) -> LanceQueryBuilder: """Set the where clause. Parameters ---------- where: str - The where clause. + The where clause which is a valid SQL where clause. See + `Lance filter pushdown `_ + for valid SQL expressions. + prefilter: bool, default False + If True, apply the filter before vector search, otherwise the + filter is applied on the result of vector search. + This feature is **EXPERIMENTAL** and may be removed and modified + without warning in the future. Returns ------- @@ -240,6 +247,7 @@ class LanceQueryBuilder(ABC): The LanceQueryBuilder object. """ self._where = where + self._prefilter = prefilter return self @@ -369,14 +377,14 @@ class LanceVectorQueryBuilder(LanceQueryBuilder): Parameters ---------- where: str - The where clause. + The where clause which is a valid SQL where clause. See + `Lance filter pushdown `_ + for valid SQL expressions. prefilter: bool, default False If True, apply the filter before vector search, otherwise the filter is applied on the result of vector search. This feature is **EXPERIMENTAL** and may be removed and modified - without warning in the future. Currently this is only supported - in OSS and can only be used with a table that does not have an ANN - index. + without warning in the future. Returns -------