Ejemplo n.º 1
0
        public StaticIndexDocsEnumerator(IEnumerable <Document> docs, List <IndexingFunc> funcs, string collection, IndexingStatsScope stats)
            : this(docs)
        {
            _documentReadStats = stats?.For(IndexingOperation.Map.DocumentRead, start: false);

            var linqStats = stats?.For(IndexingOperation.Map.Linq, start: false);

            if (funcs.Count == 1)
            {
                ResultsOfCurrentDocument =
                    new TimeCountingEnumerable(funcs[0](new DynamicIteratonOfCurrentDocumentWrapper(this)), linqStats);
            }
            else
            {
                _multipleIndexingFunctionsEnumerator = new MultipleIndexingFunctionsEnumerator(funcs, new DynamicIteratonOfCurrentDocumentWrapper(this));
                ResultsOfCurrentDocument             = new TimeCountingEnumerable(_multipleIndexingFunctionsEnumerator, linqStats);
            }

            CurrentIndexingScope.Current.SetSourceCollection(collection, linqStats);
        }
Ejemplo n.º 2
0
        public StaticIndexDocsEnumerator(IEnumerable <Document> docs, List <IndexingFunc> funcs, string collection, IndexingStatsScope stats, IndexType type)
            : this(docs)
        {
            _documentReadStats = stats?.For(IndexingOperation.Map.DocumentRead, start: false);

            var indexingFunctionType = type.IsJavaScript() ? IndexingOperation.Map.Jint : IndexingOperation.Map.Linq;

            var mapFuncStats = stats?.For(indexingFunctionType, start: false);

            if (funcs.Count == 1)
            {
                _resultsOfCurrentDocument =
                    new TimeCountingEnumerable(funcs[0](new DynamicIteratonOfCurrentDocumentWrapper(this)), mapFuncStats);
            }
            else
            {
                _multipleIndexingFunctionsEnumerator = new MultipleIndexingFunctionsEnumerator(funcs, new DynamicIteratonOfCurrentDocumentWrapper(this));
                _resultsOfCurrentDocument            = new TimeCountingEnumerable(_multipleIndexingFunctionsEnumerator, mapFuncStats);
            }

            CurrentIndexingScope.Current.SetSourceCollection(collection, mapFuncStats);
        }