Raven.Database.Tasks.RemoveFromIndexTask.FilterDocuments C# (CSharp) Метод

FilterDocuments() приватный Метод

We need to NOT remove documents that has been removed then added. We DO remove documents that would be filtered out because of an Entity Name changed, though.
private FilterDocuments ( WorkContext context, IStorageActionsAccessor accessor, string key ) : bool
context Raven.Database.Indexing.WorkContext
accessor IStorageActionsAccessor
key string
Результат bool
		private bool FilterDocuments(WorkContext context, IStorageActionsAccessor accessor, string key)
		{
			var documentMetadataByKey = accessor.Documents.DocumentMetadataByKey(key, null);
			if (documentMetadataByKey == null)
				return true;
			var generator = context.IndexDefinitionStorage.GetViewGenerator(Index);
			if (generator == null)
				return false;

			if (generator.ForEntityNames.Count == 0)
				return false;// there is a new document and this index applies to it

			var entityName = documentMetadataByKey.Metadata.Value<string>(Constants.RavenEntityName);
			if (entityName == null)
				return true; // this document doesn't belong to this index any longer, need to remove it

			return generator.ForEntityNames.Contains(entityName) == false;
		}