Esempio n. 1
0
        /// <summary>
        /// Creates the index definition.
        /// </summary>
        /// <returns></returns>
        public override IndexDefinition CreateIndexDefinition()
        {
            if (Conventions == null)
            {
                Conventions = new DocumentConventions();
            }

            var indexDefinition = new IndexDefinitionBuilder <object, TReduceResult>(IndexName)
            {
                Indexes                  = Indexes,
                Analyzers                = Analyzers,
                Reduce                   = Reduce,
                Stores                   = Stores,
                TermVectors              = TermVectors,
                SpatialIndexes           = SpatialIndexes,
                SuggestionsOptions       = IndexSuggestions,
                AnalyzersStrings         = AnalyzersStrings,
                IndexesStrings           = IndexesStrings,
                StoresStrings            = StoresStrings,
                TermVectorsStrings       = TermVectorsStrings,
                SpatialIndexesStrings    = SpatialIndexesStrings,
                OutputReduceToCollection = OutputReduceToCollection,
                PatternForOutputReduceToCollectionReferences = PatternForOutputReduceToCollectionReferences,
                PatternReferencesCollectionName = PatternReferencesCollectionName,
                AdditionalSources = AdditionalSources,
                Configuration     = Configuration,
                LockMode          = LockMode,
                Priority          = Priority
            }.ToIndexDefinition(Conventions, validateMap: false);

            foreach (var map in _maps.Select(generateMap => generateMap()))
            {
                string formattedMap = map;
                indexDefinition.Maps.Add(formattedMap);
            }

            return(indexDefinition);
        }
        /// <summary>
        /// Creates the index definition.
        /// </summary>
        /// <returns></returns>
        public override IndexDefinition CreateIndexDefinition()
        {
            if (Conventions == null)
            {
                Conventions = new DocumentConventions();
            }

            var indexDefinition = new IndexDefinitionBuilder <object, TReduceResult>
            {
                Indexes                  = Indexes,
                Analyzers                = Analyzers,
                Reduce                   = Reduce,
                Stores                   = Stores,
                TermVectors              = TermVectors,
                SpatialIndexes           = SpatialIndexes,
                SuggestionsOptions       = IndexSuggestions,
                AnalyzersStrings         = AnalyzersStrings,
                IndexesStrings           = IndexesStrings,
                StoresStrings            = StoresStrings,
                TermVectorsStrings       = TermVectorsStrings,
                SpatialIndexesStrings    = SpatialIndexesStrings,
                OutputReduceToCollection = OutputReduceToCollection,
                AdditionalSources        = AdditionalSources
            }.ToIndexDefinition(Conventions, validateMap: false);

            foreach (var map in _maps.Select(generateMap => generateMap()))
            {
                string formattedMap = map;
                if (Conventions.PrettifyGeneratedLinqExpressions)
                {
                    formattedMap = IndexPrettyPrinter.TryFormat(formattedMap);
                }
                indexDefinition.Maps.Add(formattedMap);
            }
            return(indexDefinition);
        }