예제 #1
0
 public BuildPartIndexContext(
     DocumentIndex documentIndex,
     ContentItem contentItem,
     string key,
     ContentTypePartDefinition typePartDefinition,
     ContentIndexSettings settings)
     : base(documentIndex, contentItem, key)
 {
     ContentTypePartDefinition = typePartDefinition;
     Settings = settings;
 }
예제 #2
0
 public BuildFieldIndexContext(
     DocumentIndex documentIndex,
     ContentItem contentItem,
     string key,
     ContentPart contentPart,
     ContentTypePartDefinition typePartDefinition,
     ContentPartFieldDefinition partFieldDefinition,
     ContentIndexSettings settings)
     : base(documentIndex, contentItem, key, typePartDefinition, settings)
 {
     ContentPartFieldDefinition = partFieldDefinition;
     ContentPart = contentPart;
 }
        Task IContentPartIndexHandler.BuildIndexAsync(ContentPart contentPart, ContentTypePartDefinition typePartDefinition, BuildIndexContext context, ContentIndexSettings settings)
        {
            var part = contentPart as TPart;

            if (part == null)
            {
                return(Task.CompletedTask);
            }

            var buildPartIndexContext = new BuildPartIndexContext(context.DocumentIndex, context.ContentItem, typePartDefinition.Name, typePartDefinition, settings);

            return(BuildIndexAsync(part, buildPartIndexContext));
        }
예제 #4
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);
        }