From e50a3c178337c80738c970505e8427d893496664 Mon Sep 17 00:00:00 2001 From: Bert Date: Tue, 31 Oct 2023 16:39:32 -0400 Subject: [PATCH] added api docs for prefilter flag (#617) Added the prefilter flag argument to the `LanceQueryBuilder.where`. This should make it display here: https://lancedb.github.io/lancedb/python/python/#lancedb.query.LanceQueryBuilder.select And also in intellisense like this: image Also adds some improved documentation about the `where` argument to this method. --------- Co-authored-by: Weston Pace --- python/lancedb/query.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) 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 -------