Esempio n. 1
0
        public void Index(string index,
                          AbstractViewGenerator viewGenerator,
                          IndexingBatch batch,
                          WorkContext context,
                          IStorageActionsAccessor actions,
                          DateTime minimumTimestamp)
        {
            Index value;

            if (indexes.TryGetValue(index, out value) == false)
            {
                log.Debug("Tried to index on a non existent index {0}, ignoring", index);
                return;
            }
            using (EnsureInvariantCulture())
                using (DocumentCacher.SkipSettingDocumentsInDocumentCache())
                {
                    value.IndexDocuments(viewGenerator, batch, context, actions, minimumTimestamp);
                    context.RaiseIndexChangeNotification(new IndexChangeNotification
                    {
                        Name = index,
                        Type = IndexChangeTypes.MapCompleted
                    });
                }
        }
Esempio n. 2
0
        public void Reduce(
            string index,
            AbstractViewGenerator viewGenerator,
            IEnumerable <IGrouping <int, object> > mappedResults,
            int level,
            WorkContext context,
            IStorageActionsAccessor actions,
            HashSet <string> reduceKeys)
        {
            Index value;

            if (indexes.TryGetValue(index, out value) == false)
            {
                log.Debug("Tried to index on a non existent index {0}, ignoring", index);
                return;
            }
            var mapReduceIndex = value as MapReduceIndex;

            if (mapReduceIndex == null)
            {
                log.Warn("Tried to reduce on an index that is not a map/reduce index: {0}, ignoring", index);
                return;
            }
            using (EnsureInvariantCulture())
            {
                var reduceDocuments = new MapReduceIndex.ReduceDocuments(mapReduceIndex, viewGenerator, mappedResults, level, context, actions, reduceKeys);
                reduceDocuments.ExecuteReduction();
                context.RaiseIndexChangeNotification(new IndexChangeNotification
                {
                    Name = index,
                    Type = IndexChangeTypes.ReduceCompleted
                });
            }
        }
Esempio n. 3
0
        public void RemoveFromIndex(string index, string[] keys, WorkContext context)
        {
            Index value;

            if (indexes.TryGetValue(index, out value) == false)
            {
                log.Debug("Removing from non existing index '{0}', ignoring", index);
                return;
            }
            value.Remove(keys, context);
            context.RaiseIndexChangeNotification(new IndexChangeNotification
            {
                Name = index,
                Type = IndexChangeTypes.RemoveFromIndex
            });
        }
Esempio n. 4
0
		public void RemoveFromIndex(int index, string[] keys, WorkContext context)
		{
			Index value = indexes[index];
			if (value == null)
			{
				log.Debug("Removing from non existing index '{0}', ignoring", index);
				return;
			}
			value.Remove(keys, context);
			context.RaiseIndexChangeNotification(new IndexChangeNotification
			{
				Name = value.PublicName,
				Type = IndexChangeTypes.RemoveFromIndex
			});
		}
Esempio n. 5
0
		public IndexingPerformanceStats Reduce(
			int index,
			AbstractViewGenerator viewGenerator,
			IEnumerable<IGrouping<int, object>> mappedResults,
			int level,
			WorkContext context,
			IStorageActionsAccessor actions,
			HashSet<string> reduceKeys,
			int inputCount)
		{
			Index value = indexes[index];
			if (value == null)
			{
				log.Debug("Tried to index on a non existent index {0}, ignoring", index);
				return null;
			}
			var mapReduceIndex = value as MapReduceIndex;
			if (mapReduceIndex == null)
			{
				log.Warn("Tried to reduce on an index that is not a map/reduce index: {0}, ignoring", index);
				return null;
			}
			using (EnsureInvariantCulture())
			{
				var reduceDocuments = new MapReduceIndex.ReduceDocuments(mapReduceIndex, viewGenerator, mappedResults, level, context, actions, reduceKeys, inputCount);

				var performance = reduceDocuments.ExecuteReduction();

				context.RaiseIndexChangeNotification(new IndexChangeNotification
				{
					Name = value.PublicName,
					Type = IndexChangeTypes.ReduceCompleted
				});

				return performance;
			}
		}
Esempio n. 6
0
		public IndexingPerformanceStats Index(int index, AbstractViewGenerator viewGenerator, IndexingBatch batch, WorkContext context, IStorageActionsAccessor actions, DateTime minimumTimestamp, CancellationToken token)
		{
			Index value;
			if (indexes.TryGetValue(index, out value) == false)
			{
				log.Debug("Tried to index on a non existent index {0}, ignoring", index);
				return null;
			}
			using (EnsureInvariantCulture())
			using (DocumentCacher.SkipSettingDocumentsInDocumentCache())
			{
				var performance = value.IndexDocuments(viewGenerator, batch, actions, minimumTimestamp, token);
				context.RaiseIndexChangeNotification(new IndexChangeNotification
				{
					Name = value.PublicName,
					Type = IndexChangeTypes.MapCompleted
				});

				return performance;
			}
		}
Esempio n. 7
0
		public void Reduce(
			string index, 
			AbstractViewGenerator viewGenerator, 
			IEnumerable<IGrouping<int, object>> mappedResults,
			int level,
			WorkContext context, 
			IStorageActionsAccessor actions,
			HashSet<string> reduceKeys)
		{
			Index value;
			if (indexes.TryGetValue(index, out value) == false)
			{
				log.Debug("Tried to index on a non existent index {0}, ignoring", index);
				return;
			}
			var mapReduceIndex = value as MapReduceIndex;
			if (mapReduceIndex == null)
			{
				log.Warn("Tried to reduce on an index that is not a map/reduce index: {0}, ignoring", index);
				return;
			}
			using (EnsureInvariantCulture())
			{
				var reduceDocuments = new MapReduceIndex.ReduceDocuments(mapReduceIndex, viewGenerator, mappedResults, level, context, actions, reduceKeys);
				reduceDocuments.ExecuteReduction();
				context.RaiseIndexChangeNotification(new IndexChangeNotification
				{
					Name = index,
					Type = IndexChangeTypes.ReduceCompleted
				});
			}
		}
Esempio n. 8
0
		public void Index(string index,
			AbstractViewGenerator viewGenerator,
			IndexingBatch batch,
			WorkContext context,
			IStorageActionsAccessor actions,
			DateTime minimumTimestamp)
		{
			Index value;
			if (indexes.TryGetValue(index, out value) == false)
			{
				log.Debug("Tried to index on a non existent index {0}, ignoring", index);
				return;
			}
			using (EnsureInvariantCulture())
			using (DocumentCacher.SkipSettingDocumentsInDocumentCache())
			{
				value.IndexDocuments(viewGenerator, batch, context, actions, minimumTimestamp);
				context.RaiseIndexChangeNotification(new IndexChangeNotification
				{
					Name = index,
					Type = IndexChangeTypes.MapCompleted
				});
			}
		}
Esempio n. 9
0
		public void RemoveFromIndex(string index, string[] keys, WorkContext context)
		{
			Index value;
			if (indexes.TryGetValue(index, out value) == false)
			{
				log.Debug("Removing from non existing index '{0}', ignoring", index);
				return;
			}
			value.Remove(keys, context);
			context.RaiseIndexChangeNotification(new IndexChangeNotification
			{
				Name = index,
				Type = IndexChangeTypes.RemoveFromIndex
			});
		}