diff --git a/node/src/query.ts b/node/src/query.ts index b87d0519..2338c051 100644 --- a/node/src/query.ts +++ b/node/src/query.ts @@ -38,7 +38,7 @@ export class Query { constructor (query?: T, tbl?: any, embeddings?: EmbeddingFunction) { this._tbl = tbl this._query = query - this._limit = undefined + this._limit = 10 this._nprobes = 20 this._refineFactor = undefined this._select = undefined @@ -50,6 +50,7 @@ export class Query { /*** * Sets the number of results that will be returned + * default value is 10 * @param value number of results */ limit (value: number): Query { diff --git a/node/src/test/test.ts b/node/src/test/test.ts index 62fd9b45..af87ee41 100644 --- a/node/src/test/test.ts +++ b/node/src/test/test.ts @@ -124,9 +124,9 @@ describe('LanceDB client', function () { const uri = await createTestDB(2, 100) const con = await lancedb.connect(uri) const table = (await con.openTable('vectors')) as LocalTable - let results = await table.filter('id % 2 = 0').execute() + let results = await table.filter('id % 2 = 0').limit(100).execute() assertResults(results) - results = await table.where('id % 2 = 0').execute() + results = await table.where('id % 2 = 0').limit(100).execute() assertResults(results) // Should reject a bad filter