Skip to content

Commit 72b02c0

Browse files
committed
pr feedback
1 parent bb320ff commit 72b02c0

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

src/ObjectStoreProvider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,11 @@ export abstract class DbProvider {
397397
indexName: string,
398398
searchPhrase: string,
399399
resolution: FullTextTermResolution = FullTextTermResolution.And,
400-
_limit?: number
400+
limit?: number
401401
): Promise<ItemType[]> {
402402
return this._getStoreIndexTransaction(storeName, false, indexName).then(
403403
(index) => {
404-
return index.fullTextSearch(searchPhrase, resolution, _limit);
404+
return index.fullTextSearch(searchPhrase, resolution, limit);
405405
}
406406
);
407407
}

src/tests/ObjectStoreProvider.spec.ts

+39-1
Original file line numberDiff line numberDiff line change
@@ -4880,7 +4880,7 @@ describe("ObjectStoreProvider", function () {
48804880
);
48814881
});
48824882

4883-
it("Full Text Index - Returns only the limit passed", async () => {
4883+
it("Full Text Index - Returns only the limit passed for OR resolution", async () => {
48844884
return openProvider(
48854885
provName,
48864886
{
@@ -4917,6 +4917,44 @@ describe("ObjectStoreProvider", function () {
49174917
});
49184918
});
49194919
});
4920+
4921+
it("Full Text Index - Returns only the limit passed for AND resolution", async () => {
4922+
return openProvider(
4923+
provName,
4924+
{
4925+
version: 2,
4926+
stores: [
4927+
{
4928+
name: "test",
4929+
primaryKeyPath: "id",
4930+
indexes: [
4931+
{
4932+
name: "i",
4933+
keyPath: "txt",
4934+
fullText: true,
4935+
unique: false,
4936+
},
4937+
],
4938+
},
4939+
],
4940+
},
4941+
true
4942+
).then((prov) => {
4943+
const itemsToPut = [];
4944+
for (var i = 0; i < 100; i++) {
4945+
itemsToPut.push({ id: `a${i}`, txt: `aaaaaa${i}` });
4946+
}
4947+
4948+
prov.put("test", itemsToPut).then(() => {
4949+
prov
4950+
.fullTextSearch("test", "i", "a", FullTextTermResolution.And, 10)
4951+
.then((results) => {
4952+
assert.equal(results.length, 10);
4953+
prov.close();
4954+
});
4955+
});
4956+
});
4957+
});
49204958
});
49214959
});
49224960
});

0 commit comments

Comments
 (0)