Question

I'm developing Sharepoint Search with own Content Source. And I have my crawl properties and my managed properties and mapping between them accordingly. Also I have dynamic properties, e.g. the user can change the set of properties to crawling,therefore I make it at runtime from Sharepoint Central Administration. I'm using the following code to do that:

    private static void CreateProperty(string propertyName, Category category, ManagedPropertyCollection managedProperties)
    {
        var crawledProperty = category.CreateCrawledProperty(propertyName, false, Constants.CategoryId, 31);
        crawledProperty.IsMappedToContents = true;
        SetMapping(crawledProperty, managedProperties);
        crawledProperty.Update();
    }

    private static void SetMapping(CrawledProperty cProp, ManagedPropertyCollection managedProperties)
    {
        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;
    }

The static properties adds while installation, the dynamic properties adds manualy at Central Administration. I'm using the same code to add properties while installation and setting manualy at Central Administration.

The problem is the value of Sharepoint flag "Included in index" for crawl properties. In the case, when the installation has been completed, the value of this flag is TRUE (yes) for all static crawl properties. Otherwise, for dynamic properties this flag is FALSE (no). I need to have always checked flag "Included in index" .

As I know, the property IsMappedToContents of CrawlProperty class is responsable to "Included to index" value, but it doesn't work for me!

Do you have any idea to do that? And what I do wrongly?

Thanks in advance.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top