Skip to content

Difference between content property and schema property marked as isContent? #30

@shuodashen

Description

@shuodashen

According to ContentItem Definition, each ContentItem has a top-level content field. At the same time, one of the properties in propertyValues can be marked as isContent in the schema using searchAnnotations

What's the difference between these two?
Are both used for full-text indexing or semantic vectorization?
If I already mark a schema property as isContent, should I still populate the top-level content field, or are they interchangeable?

This is my code:

        public static DataSourceSchema GetSchema()
        {
            DataSourceSchema schema = new DataSourceSchema();

            schema.PropertyList.Add(
                new SourcePropertyDefinition
                {
                    Name = nameof(summary),
                    Type = SourcePropertyType.String,
                    DefaultSearchAnnotations = (uint)(SearchAnnotations.IsSearchable | SearchAnnotations.IsContent),
                    RequiredSearchAnnotations = (uint)(SearchAnnotations.IsSearchable | SearchAnnotations.IsContent),
                });

            return schema;
         }


        public CrawlItem ToCrawlItem()
        {
            CrawlItem item = new CrawlItem
            {
                ItemType = CrawlItem.Types.ItemType.ContentItem,
                ItemId = this.meetingId,
                ContentItem = this.GetContentItem(),
            };
            return item;
        }

        private ContentItem GetContentItem()
        {
            return new ContentItem
            {
                AccessList = this.GetAccessControlList(),
                PropertyValues = this.GetSourcePropertyValueMap(),
               //1. content property is set with summary value
                Content = new Content
                {
                    ContentType = Content.Types.ContentType.Text,
                    ContentValue = this.summary
                }
            };
        }

        private SourcePropertyValueMap GetSourcePropertyValueMap()
        {
            SourcePropertyValueMap sourcePropertyValueMap = new SourcePropertyValueMap();
            //2. summary(set "isContent in schema") in propertyValues is also set as summary value 
            sourcePropertyValueMap.Values.Add(
                nameof(this.summary),
                new GenericType
                {
                    StringValue = summary,
                });

            return sourcePropertyValueMap;
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions