zebrashop-hotmail
-
9/29/2009 1:24:31 PM
Document not found in Search results when added with Kentico API
Hi all,
As explained in the Kentico CMS Developer's Guide I added a News document with the API as shown below. It then shows up under News items, but when I search for 'Obama', NO results occur. However, when I go to CMSDesk, select the newly added news item and press save, it does show up when searching for the term 'Obama'. It looks like the news item wasn't added to the search index when using the API. What am I doing wrong here? Thanks.
string newsName = "Obama visits Europe";
// create tree provider instance TreeProvider provider = new TreeProvider(CMSContext.CurrentUser);
// get parent node for new document CMS.TreeEngine.TreeNode parent = provider.SelectSingleNode(CMSContext.CurrentSiteName, "/News", "en-us");
// create a new tree node CMS.TreeEngine.TreeNode node = new CMS.TreeEngine.TreeNode("cms.news", provider);
if (parent != null) { // set document properties node.NodeName = newsName; node.NodeAlias = newsName; node.SetValue("NewsTitle", newsName); node.SetValue("NewsSummary", "Coming friday Obama will meet with European leaders"); node.SetValue("NewsText", "Some text is going here"); node.SetValue("NewsReleaseDate", DateTime.Now); node.DocumentCulture = parent.DocumentCulture;
// create new document node.Insert(parent.NodeID); }
|