feat(nodejs): feature parity [5/N] - add query.filter() alias (#1391)

to make the transition from `vectordb` to `@lancedb/lancedb` as seamless
as possible, this adds `query.filter` with a deprecated tag.


depends on https://github.com/lancedb/lancedb/pull/1390
see actual diff here
https://github.com/universalmind303/lancedb/compare/list-indices-name...universalmind303:query-filter
This commit is contained in:
Cory Grinstead
2024-06-21 16:03:58 -05:00
committed by GitHub
parent 3cd84c9375
commit a797f5fe59
2 changed files with 12 additions and 0 deletions

View File

@@ -362,6 +362,10 @@ describe("When creating an index", () => {
for await (const r of tbl.query().where("id > 1").select(["id"])) {
expect(r.numRows).toBe(298);
}
// should also work with 'filter' alias
for await (const r of tbl.query().filter("id > 1").select(["id"])) {
expect(r.numRows).toBe(298);
}
});
// TODO: Move this test to the query API test (making sure we can reject queries

View File

@@ -114,6 +114,14 @@ export class QueryBase<
this.inner.onlyIf(predicate);
return this as unknown as QueryType;
}
/**
* A filter statement to be applied to this query.
* @alias where
* @deprecated Use `where` instead
*/
filter(predicate: string): QueryType {
return this.where(predicate);
}
/**
* Return only the specified columns.