public IndexChanges Solidify() { // Verify that the running list of hijack changes is the same as the pre-computed hijack document. Guard.Assert(HijackChanges.Count == HijackDocuments.Count, "The hijack document state has diverged."); foreach (var pair in HijackChanges) { var expected = InitializeHijackDocumentChanges(pair.Value); var actual = HijackDocuments[pair.Key]; Guard.Assert( expected == actual, $"The hijack document for {pair.Key.ToFullString()} is different than the list of index changes."); } return(new IndexChanges( SearchChanges.ToDictionary(x => x.Key, x => x.Value), HijackDocuments.ToDictionary(x => x.Key, x => x.Value.Solidify()))); }
private void MergeSearchIndexChanges(SearchFilters searchFilters, SICT addedType) { if (!SearchChanges.TryGetValue(searchFilters, out var existingType)) { SearchChanges[searchFilters] = addedType; return; } // If the search index change type is the same, move on. if (existingType == addedType) { return; } var transition = new StateTransition(existingType, addedType); if (AcceptableTransitions.TryGetValue(transition, out var result)) { SearchChanges[searchFilters] = result; return; } Guard.Fail($"A {existingType} search index change cannot be replaced with {addedType}."); }