/// <summary> /// Remove the object from all indexes /// </summary> /// <param name="primary"></param> private PackedObject InternalRemoveByPrimaryKey(KeyValue primary) { Dbg.Trace($"remove by primary key {primary}"); var toRemove = DataByPrimaryKey[primary]; DataByPrimaryKey.Remove(primary); foreach (var metadata in CollectionSchema.ServerSide) { if (metadata.IndexType == IndexType.Unique) { _dataByUniqueKey[metadata.Name].Remove(toRemove[metadata.Order]); } if (metadata.IndexType == IndexType.Ordered || metadata.IndexType == IndexType.Dictionary) { _dataByIndexKey[metadata.Name].RemoveOne(toRemove); } } _fullTextIndex?.DeleteDocument(primary); return(toRemove); }
public void NotFindTerm_DocumentDeleted() { var documentId = index.IndexTerms(new[] { "Term" }); index.DeleteDocument(documentId); index.IndexedDocuments.Should().BeEquivalentTo(); index.GetMatchingDocuments("Term").Should().BeEquivalentTo(); }