Beispiel #1
0
        public CreateIndexDescriptor AddWarmer(Func <CreateWarmerDescriptor, CreateWarmerDescriptor> warmerSelector)
        {
            warmerSelector.ThrowIfNull("warmerSelector");
            var descriptor = warmerSelector(new CreateWarmerDescriptor());

            var mapping = new WarmerMapping {
                Name = descriptor._WarmerName, Types = descriptor._Types, Source = descriptor._SearchDescriptor
            };

            this._indexSettings.Warmers.Add(descriptor._WarmerName, mapping);

            return(this);
        }
Beispiel #2
0
        public CreateIndexDescriptor AddWarmer(Func <CreateWarmerDescriptor, CreateWarmerDescriptor> warmerSelector)
        {
            warmerSelector.ThrowIfNull("warmerSelector");
            var descriptor = warmerSelector(new CreateWarmerDescriptor());

            var query = JsonConvert.SerializeObject(descriptor._SearchDescriptor, serializationSettings);

            var mapping = new WarmerMapping {
                Name = descriptor._WarmerName, Types = descriptor._Types, Source = query
            };

            this._IndexSettings.Warmers.Add(descriptor._WarmerName, mapping);

            return(this);
        }
        public TemplateMappingDescriptor AddWarmer <T>(Func <CreateWarmerDescriptor, CreateWarmerDescriptor> warmerSelector)
            where T : class
        {
            warmerSelector.ThrowIfNull("warmerSelector");
            var warmerDescriptor = warmerSelector(new CreateWarmerDescriptor());

            warmerDescriptor.ThrowIfNull("warmerDescriptor");
            warmerDescriptor._WarmerName.ThrowIfNull("warmer has no name");

            var query = this._serializer.Serialize(warmerDescriptor._SearchDescriptor);

            var warmer = new WarmerMapping {
                Name = warmerDescriptor._WarmerName, Types = warmerDescriptor._Types, Source = query
            };

            this._TemplateMapping.Warmers[warmerDescriptor._WarmerName] = warmer;
            return(this);
        }
Beispiel #4
0
        public PutTemplateDescriptor AddWarmer <T>(Func <CreateWarmerDescriptor, CreateWarmerDescriptor> warmerSelector)
            where T : class
        {
            warmerSelector.ThrowIfNull("warmerSelector");
            var warmerDescriptor = warmerSelector(new CreateWarmerDescriptor());

            warmerDescriptor.ThrowIfNull("warmerDescriptor");
            warmerDescriptor._WarmerName.ThrowIfNull("warmer has no name");

            var warmer = new WarmerMapping
            {
                Name   = warmerDescriptor._WarmerName,
                Types  = warmerDescriptor._Types,
                Source = warmerDescriptor._SearchDescriptor
            };

            Self.TemplateMapping.Warmers[warmerDescriptor._WarmerName] = warmer;
            return(this);
        }