Don't index templates during full space reindex

pull/569/head
Zef Hemel 2023-11-15 13:41:36 +01:00
parent 35e2afc18b
commit b359d9e065
1 changed files with 25 additions and 15 deletions

View File

@ -35,24 +35,34 @@ export async function processIndexQueue(messages: MQMessage[]) {
console.log(`Indexing page ${name}`);
const text = await space.readPage(name);
const parsed = await markdown.parseMarkdown(text);
if (isTemplate(text)) {
console.log("Indexing", name, "as template");
await events.dispatchEvent("page:indexTemplate", {
name,
tree: parsed,
});
} else {
await events.dispatchEvent("page:index", {
name,
tree: parsed,
});
}
}
}
export async function parseIndexTextRepublish({ name, text }: IndexEvent) {
const parsed = await markdown.parseMarkdown(text);
if (isTemplate(text)) {
console.log("Indexing", name, "as template");
await events.dispatchEvent("page:indexTemplate", {
name,
tree: parsed,
});
} else {
await events.dispatchEvent("page:index", {
name,
tree: parsed,
});
}
}
export async function parseIndexTextRepublish({ name, text }: IndexEvent) {
if (isTemplate(text)) {
console.log("Indexing", name, "as template");
await events.dispatchEvent("page:indexTemplate", {
name,
tree: await markdown.parseMarkdown(text),
});
} else {
await events.dispatchEvent("page:index", {
name,
tree: await markdown.parseMarkdown(text),
});
}
}