diff --git a/web/src/engine/predictive-text/worker-thread/src/main/correction/search-quotient-root.ts b/web/src/engine/predictive-text/worker-thread/src/main/correction/search-quotient-root.ts index 845b47c843..8346c62ba1 100644 --- a/web/src/engine/predictive-text/worker-thread/src/main/correction/search-quotient-root.ts +++ b/web/src/engine/predictive-text/worker-thread/src/main/correction/search-quotient-root.ts @@ -68,7 +68,7 @@ export class SearchQuotientRoot implements SearchQuotientNode { */ public handleNextNode(): PathResult { if(this.hasBeenProcessed) { - return null; + return { type: 'none' }; } this.hasBeenProcessed = true; diff --git a/web/src/engine/predictive-text/worker-thread/src/main/correction/search-quotient-spur.ts b/web/src/engine/predictive-text/worker-thread/src/main/correction/search-quotient-spur.ts index ce94280950..fb08e99ce8 100644 --- a/web/src/engine/predictive-text/worker-thread/src/main/correction/search-quotient-spur.ts +++ b/web/src/engine/predictive-text/worker-thread/src/main/correction/search-quotient-spur.ts @@ -171,6 +171,10 @@ export abstract class SearchQuotientSpur implements SearchQuotientNode { // spaces are in sequence here. // `this` = head 'space'. public merge(space: SearchQuotientNode): SearchQuotientNode { + if(this.model != space.model) { + throw new Error("Cannot merge search graphs based on different LexicalModels"); + } + // Head node for the incoming path is empty, so skip it. if(space.parents.length == 0 || space instanceof SearchQuotientRoot) { return this; diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/search-quotient-root.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/search-quotient-root.tests.ts index a140376c24..f9c15a24ad 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/search-quotient-root.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/search-quotient-root.tests.ts @@ -23,7 +23,7 @@ import TrieModel = models.TrieModel; const testModel = new TrieModel(jsonFixture('models/tries/english-1000')); const altModel = new TrieModel(jsonFixture('models/tries/accented')); -describe('SearchQuotientSpur', () => { +describe('SearchQuotientRoot', () => { describe('constructor', () => { it('initializes from a lexical model', () => { const path = new SearchQuotientRoot(testModel); @@ -44,7 +44,7 @@ describe('SearchQuotientSpur', () => { assert.deepEqual(constituentPaths(path), []); }); - describe('.isSameNode returns true for separate instance on same model', () => { + it('.isSameNode returns true for separate instance on same model', () => { const root1 = new SearchQuotientRoot(testModel); const root2 = new SearchQuotientRoot(testModel);