コード例 #1
0
        /// <summary>
        /// Creates the index definition.
        /// </summary>
        /// <returns></returns>
        public override IndexDefinition CreateIndexDefinition()
        {
            if (Conventions == null)
            {
                Conventions = new DocumentConvention();
            }

            var indexDefinition = new IndexDefinitionBuilder <object, TReduceResult>()
            {
                Indexes                    = Indexes,
                SortOptions                = IndexSortOptions,
                SortOptionsStrings         = IndexSortOptionsStrings,
                Analyzers                  = Analyzers,
                Reduce                     = Reduce,
                Stores                     = Stores,
                TermVectors                = TermVectors,
                SpatialIndexes             = SpatialIndexes,
                SuggestionsOptions         = IndexSuggestions,
                AnalyzersStrings           = AnalyzersStrings,
                IndexesStrings             = IndexesStrings,
                StoresStrings              = StoresStrings,
                TermVectorsStrings         = TermVectorsStrings,
                SpatialIndexesStrings      = SpatialIndexesStrings,
                MaxIndexOutputsPerDocument = MaxIndexOutputsPerDocument
            }.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);
        }
コード例 #2
0
        /// <summary>
        /// Creates the index definition.
        /// </summary>
        /// <returns></returns>
        public override IndexDefinition CreateIndexDefinition()
        {
            if (Conventions == null)
            {
                Conventions = new DocumentConvention();
            }

            var indexDefinition = new IndexDefinitionBuilder <object, TReduceResult>
            {
                Indexes            = Indexes,
                SortOptions        = IndexSortOptions,
                SortOptionsStrings = IndexSortOptionsStrings,
                Analyzers          = Analyzers,
                Reduce             = Reduce,
#pragma warning disable 612,618
                TransformResults = TransformResults,
#pragma warning restore 612,618
                Stores                     = Stores,
                TermVectors                = TermVectors,
                SpatialIndexes             = SpatialIndexes,
                Suggestions                = IndexSuggestions,
                AnalyzersStrings           = AnalyzersStrings,
                IndexesStrings             = IndexesStrings,
                StoresStrings              = StoresStrings,
                TermVectorsStrings         = TermVectorsStrings,
                SpatialIndexesStrings      = SpatialIndexesStrings,
                DisableInMemoryIndexing    = DisableInMemoryIndexing,
                MaxIndexOutputsPerDocument = MaxIndexOutputsPerDocument
            }.ToIndexDefinition(Conventions, validateMap: false);

            foreach (var map in maps.Select(generateMap => generateMap()))
            {
                indexDefinition.Maps.Add(map);
            }
            return(indexDefinition);
        }