link fix
This commit is contained in:
parent
92a077009e
commit
7886947a65
|
|
@ -1 +1 @@
|
||||||
1.1.5
|
1.1.7
|
||||||
|
|
@ -14,21 +14,28 @@
|
||||||
|
|
||||||
const linkedPersons = liveQuery(async () => {
|
const linkedPersons = liveQuery(async () => {
|
||||||
const allHistory = await db.historyEntries.filter(h => !h.deletedAt).toArray();
|
const allHistory = await db.historyEntries.filter(h => !h.deletedAt).toArray();
|
||||||
|
const allTopics = await db.topics.filter(t => !t.deletedAt).toArray();
|
||||||
const personContexts = await db.contexts.filter(c => !c.deletedAt && c.type === 'person').toArray();
|
const personContexts = await db.contexts.filter(c => !c.deletedAt && c.type === 'person').toArray();
|
||||||
|
|
||||||
|
// Persons referenced in history entries that mention this company
|
||||||
const matchingPersonNames = new Set<string>();
|
const matchingPersonNames = new Set<string>();
|
||||||
for (const h of allHistory) {
|
for (const h of allHistory) {
|
||||||
if (extractCompanies(h.text).includes(entityName)) {
|
if (extractCompanies(h.text).includes(entityName)) {
|
||||||
for (const m of extractMentions(h.text)) {
|
for (const m of extractMentions(h.text)) matchingPersonNames.add(m);
|
||||||
matchingPersonNames.add(m);
|
for (const a of extractAssignments(h.text)) matchingPersonNames.add(a);
|
||||||
}
|
}
|
||||||
for (const a of extractAssignments(h.text)) {
|
}
|
||||||
matchingPersonNames.add(a);
|
|
||||||
}
|
// Person contexts whose topics mention this company directly
|
||||||
|
const personContextIdsWithCompanyInTopics = new Set<string>();
|
||||||
|
for (const t of allTopics) {
|
||||||
|
if (extractCompanies(t.body ?? '').includes(entityName)) {
|
||||||
|
personContextIdsWithCompanyInTopics.add(t.contextId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return personContexts.filter(p => {
|
return personContexts.filter(p => {
|
||||||
|
if (personContextIdsWithCompanyInTopics.has(p.id)) return true;
|
||||||
const pName = p.name.replace(/^Person\s+/, '');
|
const pName = p.name.replace(/^Person\s+/, '');
|
||||||
return matchingPersonNames.has(pName);
|
return matchingPersonNames.has(pName);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
21
roadmap.md
21
roadmap.md
|
|
@ -25,3 +25,24 @@ Szenario: Gerät A löscht Item (version N+1), hat aber noch nie gepusht. Gerät
|
||||||
|
|
||||||
**Empfehlung**
|
**Empfehlung**
|
||||||
Option 2 (Tombstones) für korrekte Multi-Gerät-Unterstützung. Option 3 als pragmatischer Zwischenschritt wenn Full-Sync (since=null) garantiert ist.
|
Option 2 (Tombstones) für korrekte Multi-Gerät-Unterstützung. Option 3 als pragmatischer Zwischenschritt wenn Full-Sync (since=null) garantiert ist.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [LOW] Verlinkung: Index für @F:/@P:/@NAME-Tags
|
||||||
|
|
||||||
|
**Aktueller Stand**
|
||||||
|
`CompanyPersonsView` und ähnliche Views scannen beim Öffnen alle Topics + History-Einträge per Regex (O(n) über gesamten Content, in-memory via Dexie).
|
||||||
|
|
||||||
|
**Skalierbarkeit**
|
||||||
|
Für den typischen PKM-Anwendungsfall (< 10.000 Einträge, ein User, lokal) kein Problem. Ab ~5.000 Einträgen potenziell spürbar (> 200ms).
|
||||||
|
|
||||||
|
**Lösungsoptionen**
|
||||||
|
|
||||||
|
1. **Berechnetes Feld beim Schreiben** (pragmatisch)
|
||||||
|
Beim Speichern eines Topics/History-Eintrags die Tags extrahieren und als Array in einer eigenen Spalte speichern (`companyRefs: string[]`, `personRefs: string[]`). Dexie kann darauf einen echten `MultiEntry`-Index anlegen → O(1) Lookup statt O(n) Scan. Kein Background-Worker nötig.
|
||||||
|
|
||||||
|
2. **SQLite FTS5 (serverseitig)**
|
||||||
|
Volltext-Index auf dem Server, Lookup per API. Höherer Aufwand, sinnvoll erst bei Multi-User-Szenarien.
|
||||||
|
|
||||||
|
**Empfehlung**
|
||||||
|
Nichts ändern bis die Query spürbar langsam wird. Dann Option 1 (berechnetes Feld + Dexie MultiEntry-Index) als einfachster Mittelweg.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue