Exemple #1
0
        public void Enrich(ContentData data)
        {
            Guard.NotNull(data, nameof(data));
            Guard.NotEmpty(languages, nameof(languages));

            foreach (var field in schema.FieldsByName.Values)
            {
                var fieldData = data.GetOrCreate(field.Name, k => new ContentFieldData());

                if (field.RawProperties.IsLocalizable)
                {
                    foreach (var language in languages)
                    {
                        Enrich(field, fieldData, language);
                    }
                }
                else
                {
                    Enrich(field, fieldData, Language.Invariant);
                }

                if (fieldData.Count > 0)
                {
                    data.AddField(field.Name, fieldData);
                }
            }
        }
        public void Enrich(ContentData data)
        {
            Guard.NotNull(data, nameof(data));

            foreach (var field in schema.FieldsByName.Values)
            {
                var fieldData      = data.GetOrCreate(field.Name, k => new ContentFieldData());
                var fieldPartition = partitionResolver(field.Paritioning);

                foreach (var partitionItem in fieldPartition)
                {
                    Enrich(field, fieldData, partitionItem);
                }

                if (fieldData.Count > 0)
                {
                    data.AddField(field.Name, fieldData);
                }
            }
        }