コード例 #1
0
ファイル: GenerateIndexData.cs プロジェクト: sealfighter/SI4T
		public override void Transform(Engine engine, Package package)
		{
            this.Initialize(engine, package);
            //Initialize field processor from package variables
            FieldProcessor processor = new FieldProcessor();
            processor.Initialize(package);
            SearchData data = new SearchData(processor);
            if (this.IsPageTemplate)
            {
                UpdateFlaggedDcps(data.ProcessPage(this.GetPage()));
            }
            else
            {
                data.ProcessComponentPresentation(new Tridion.ContentManager.CommunicationManagement.ComponentPresentation(this.GetComponent(), this.GetComponentTemplate()),GetFlaggedDcps());    
            }
            SerializeAndPushToPackage(data);
		}
コード例 #2
0
ファイル: TemplateBase.cs プロジェクト: sealfighter/SI4T
 /// <summary>
 /// Serialize search index data and push it into the package
 /// </summary>
 /// <param name="searchData">search data to serialize</param>
 protected void SerializeAndPushToPackage(SearchData searchData)
 {
     if (searchData.HasIndexData())
     {
         //prevent unwanted namespaces from appearing in the output
         XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
         ns.Add("", ""); 
         XmlDocument xmlData = new XmlDocument();
         xmlData.LoadXml(SerializeObjectToXml(searchData, ns));
         XmlElement body = searchData.GetCatchAllElement();
         XmlElement custom = searchData.GetCustomElement();
         XmlNode bodyNode = xmlData.ImportNode(body, true);
         XmlNode customNode = xmlData.ImportNode(custom, true);
         xmlData.DocumentElement.AppendChild(bodyNode);
         xmlData.DocumentElement.AppendChild(customNode);
         this.PushXmlDocumentToPackage(Constants.PACKAGE_ITEM_SEARCHDATA, xmlData);
     }
 }