1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-08-29 16:50:13 +02:00

minor refactoring to align with the documentation

This commit is contained in:
Thomas Wilkerling
2025-03-30 21:57:37 +02:00
parent bdfddd5509
commit 40f17691bf
118 changed files with 870 additions and 816 deletions

View File

@@ -227,15 +227,31 @@ export default function(DB, DBClass){
// mount database to the index
//await db.mount(document);
//expect(document.index.get("primaryTitle").db).to.be.instanceof(db.constructor);
//document.clear();
//await document.clear();
// add test data
for(let i = 0; i < data.length; i++){
document.add(data[i]);
}
expect(document.index.get("primaryTitle").reg.size).to.equal(2);
expect(document.index.get("primaryTitle").map.size).to.equal(25);
expect(document.index.get("originalTitle").reg.size).to.equal(2);
expect(document.index.get("originalTitle").map.size).to.equal(25);
// tag pseudo indexes (persistent only)
expect(document.index.get("startYear").reg.size).to.equal(2);
expect(document.index.get("startYear").map.size).to.equal(0);
expect(document.index.get("genres").reg.size).to.equal(2);
expect(document.index.get("genres").map.size).to.equal(0);
expect(document.reg.size).to.equal(2);
expect(document.store.size).to.equal(2);
expect(document.tag.size).to.equal(2);
expect(document.tag.get("startYear").size).to.equal(2);
expect(document.tag.get("genres").size).to.equal(3);
// transfer changes in bulk
await document.commit();
//await new Promise(resolve => setTimeout(resolve, 200));
expect(document.index.get("primaryTitle").reg.size).to.equal(0);
expect(document.index.get("primaryTitle").map.size).to.equal(0);