1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-08-24 14:42:55 +02:00
This commit is contained in:
Thomas Wilkerling
2025-05-21 10:57:43 +02:00
parent e9c26f06b4
commit 103f617ad5
174 changed files with 16528 additions and 14980 deletions

View File

@@ -14,9 +14,11 @@ if(!build_light) describe("Cache", function(){
it("Should have been cached and sorted by popularity/latest", function(){
const limit = 0;
const index = new Index({
tokenize: "reverse",
cache: 2
cache: 2,
limit
});
index.add(0, "foo")
@@ -27,8 +29,8 @@ if(!build_light) describe("Cache", function(){
expect(index.searchCache("bar")).to.eql([1, 2]);
expect(index.searchCache("foobar")).to.eql([2]);
expect(index.cache.cache.size).to.equal(2); // limit = 2
env || expect(index.cache.last).to.equal("foobar");
expect(index.cache.cache.size).to.equal(2);
env || expect(index.cache.last).to.equal("foobar" + limit);
expect(Array.from(index.cache.cache.values()).pop()).to.eql([2]);
expect(index.searchCache("foobar")).to.eql([2]);
@@ -36,7 +38,7 @@ if(!build_light) describe("Cache", function(){
expect(index.searchCache("foo")).to.eql([0, 2]);
expect(index.cache.cache.size).to.equal(2);
env || expect(index.cache.last).to.equal("foo");
env || expect(index.cache.last).to.equal("foo" + limit);
expect(Array.from(index.cache.cache.values()).pop()).to.eql([0, 2]);
expect(index.searchCache("bar")).to.eql([1, 2]);