diff --git a/node/src/index.ts b/node/src/index.ts index 7489b049..50f48509 100644 --- a/node/src/index.ts +++ b/node/src/index.ts @@ -293,6 +293,8 @@ export class Query { return this } + where = this.filter + /** Return only the specified columns. * * @param value Only select the specified columns. If not specified, all columns will be returned. diff --git a/node/src/test/test.ts b/node/src/test/test.ts index 87d881be..06133369 100644 --- a/node/src/test/test.ts +++ b/node/src/test/test.ts @@ -64,13 +64,20 @@ describe('LanceDB client', function () { assert.equal(results[0].id, 1) }) - it('uses a filter', async function () { + it('uses a filter / where clause', async function () { + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type + const assertResults = (results: Array>) => { + assert.equal(results.length, 1) + assert.equal(results[0].id, 2) + } + const uri = await createTestDB() const con = await lancedb.connect(uri) const table = await con.openTable('vectors') - const results = await table.search([0.1, 0.1]).filter('id == 2').execute() - assert.equal(results.length, 1) - assert.equal(results[0].id, 2) + let results = await table.search([0.1, 0.1]).filter('id == 2').execute() + assertResults(results) + results = await table.search([0.1, 0.1]).where('id == 2').execute() + assertResults(results) }) it('select only a subset of columns', async function () {