"Include values for this property in the search index" setting programmatically

Oct 20, 2008 at 9:15 AM
Edited Oct 20, 2008 at 9:16 AM
Hi All, I have created crawled property in code, but the "Include values for thisproperty in the search index" check box doesn't checked by default. Also I can't find where it sets in object model. Could you advice something?
Oct 22, 2008 at 9:25 AM
Hi Zan,

Can you post your code? I guess you have something like

Category category = categories[someGuid];
category.CreateOrGetCrawledProperty("MyProperty", false, propsetGuid, 31); // non-enumerable string property
category.Update();

Also, have you created a managed property and mapped your crawled property to it?

Thx
Feb 2, 2009 at 8:21 AM
Hi,

I create own category:
                    category = categories.Create("Acadre Category", ProtocolHandler.AcadreCategoryId);
                    //category.AutoCreateNewManagedProperties = true;
                    CreateProperties(category, sspSchema.AllManagedProperties);
                    category.Update();
properties:
            CrawledProperty crawledProperty = category.CreateCrawledProperty(propertyName, false, ProtocolHandler.AcadreCategoryId, 31);
            crawledProperty.IsMappedToContents = true;
            SetMapping(crawledProperty, managedProperties);
mapping:
            ManagedProperty mProp = managedProperties.Create(cProp.Name, ManagedDataType.Text);
            mProp.EnabledForScoping = true;
            Mapping newMapping = new Mapping(cProp.Propset, cProp.Name, cProp.VariantType, mProp.PID);
            MappingCollection mappings = mProp.GetMappings();
            mappings.Add(newMapping);
            mProp.SetMappings(mappings);
            mProp.EnabledForScoping = true;

Feb 18, 2009 at 8:16 AM
Hi,

Try re-setting the property IsMappedToContents , this should be the last line, after your property is created and mapped

// Properties are reset.

 

foreach (CrawledProperty cp in managedProperty.GetMappedCrawledProperties(1000))

 

{

cp.IsMappedToContents =

true;

 

cp.Update();

}