Exemplo n.º 1
0
        Task IContentFieldIndexHandler.BuildIndexAsync(ContentPart contentPart, ContentTypePartDefinition typePartDefinition, ContentPartFieldDefinition partFieldDefinition, BuildIndexContext context, ContentIndexSettings settings)
        {
            if (!string.Equals(typeof(TField).Name, partFieldDefinition.FieldDefinition.Name) &&
                !string.Equals(nameof(ContentField), partFieldDefinition.FieldDefinition.Name))
            {
                return(Task.CompletedTask);
            }

            var field = contentPart.Get <TField>(partFieldDefinition.Name);

            if (field != null)
            {
                var buildFieldIndexContext = new BuildFieldIndexContext(context.DocumentIndex, context.ContentItem, $"{typePartDefinition.Name}.{partFieldDefinition.Name}", contentPart, typePartDefinition, partFieldDefinition, settings);

                return(BuildIndexAsync(field, buildFieldIndexContext));
            }

            return(Task.CompletedTask);
        }
Exemplo n.º 2
0
 public abstract Task BuildIndexAsync(TField field, BuildFieldIndexContext context);