Perform initial index
parent
4277de2184
commit
9b5fa44fb6
|
@ -100,10 +100,10 @@ To allow outside connections, pass -L 0.0.0.0 as a flag, and put a TLS terminato
|
||||||
system = serverSystem.system;
|
system = serverSystem.system;
|
||||||
if (options.reindex) {
|
if (options.reindex) {
|
||||||
console.log("Reindexing space (requested via --reindex flag)");
|
console.log("Reindexing space (requested via --reindex flag)");
|
||||||
await serverSystem.system.loadedPlugs.get("index")!.invoke(
|
serverSystem.system.loadedPlugs.get("index")!.invoke(
|
||||||
"reindexSpace",
|
"reindexSpace",
|
||||||
[],
|
[],
|
||||||
);
|
).catch(console.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,5 @@ export class SimpleSearchEngine {
|
||||||
}
|
}
|
||||||
await this.index.delete(keysToDelete);
|
await this.index.delete(keysToDelete);
|
||||||
await this.reverseIndex.delete(revKeysToDelete);
|
await this.reverseIndex.delete(revKeysToDelete);
|
||||||
// console.log("Deleted", documentId, keysToDelete, revKeysToDelete);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,17 @@ export class ServerSystem {
|
||||||
}
|
}
|
||||||
})().catch(console.error);
|
})().catch(console.error);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Check if this space was ever indexed before
|
||||||
|
if (!await this.kvStore.has("$initialIndexCompleted")) {
|
||||||
|
console.log("Indexing space for the first time (in the background)");
|
||||||
|
this.system.loadedPlugs.get("index")!.invoke(
|
||||||
|
"reindexSpace",
|
||||||
|
[],
|
||||||
|
).then(() => {
|
||||||
|
this.kvStore.set("$initialIndexCompleted", true);
|
||||||
|
}).catch(console.error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadPlugs() {
|
async loadPlugs() {
|
||||||
|
|
Loading…
Reference in New Issue