More in this section

Forums / Developing with Sitefinity / Search not Indexing Migrated Content

Search not Indexing Migrated Content

3 posts, 0 answered
  1. Sashank
    Sashank avatar
    7 posts
    Registered:
    29 Jul 2008
    24 Jun 2010
    Link to this post
    Hi,

    We have migrated data into Sitefinity 3.7 from a legacy CMS system - The pages, navigation and content all work perfectly.

    However, our search index doesnt seem to index the migrated content.

    If we edit a page, make a small modification to a generic content control, then save and publish, the content is now indexed and searchable!

    I compared the HTML content that was migrated compared to that after a Sitfinity save, and they are identical.

    I wrote a piece of code that would simulate the steps of editing a page, modifying the content, saving then publishing.  See snippet below:-

    ICmsPage currentPage = (ICmsPage)manager.GetPage(page.ID, true);
              
    IStagedPage staged = currentPage.Staged.CheckOut();
      
    //enumerate all controls on page
    foreach (ICmsWebControl c in staged.Controls)
    {
       //determine if control is generic content
       if (c.ControlType == typeof(Telerik.Cms.Engine.WebControls.GenericContent))
       {
         //load control
         var gcControl = c.LoadControl() as GenericContent;
                              
        //append space
        gcControl.Content = gcControl.Content + " ";
      
        //save control
        manager.SaveControl(c);
       }
    }
      
    //check in
    ((ICmsPage)manager.GetPage(currentPage.ID, true)).Staged.CheckIn();
      
    //save page
    manager.SavePage(currentPage);
                      
    //publish page
    currentPage.Publish();

    This code seems to work - it updates all generic content controls on all pages.  I can navigate to any page and confirm that the additional space has been added to the content.

    But still the content is not included in search!!! - I have tried rebuilding the index, the result is the same.

    Help!!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    24 Jun 2010
    Link to this post
    Hi Sashank,

    When you publish a page the index is triggered internally and Lucene segments files are updated properly with the new data. If you run the index over all pages  from Sitefinity >> Administration >> Search the segment files will be properly updated. When you publish the page we call a handler and it is not necessary to update the index manually from Sitefinity >> Administration >> Search. Both the ways are equivalent - they update the Lucene segment files under App_Data/Search[your search index name]

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Sashank
    Sashank avatar
    7 posts
    Registered:
    29 Jul 2008
    24 Jun 2010
    Link to this post
    Thanks Ivan,

    But I'm not sure that helps me.

    If I edit and publish a page that has been migrated the search works.  There are too many pages for me to do this for every page.

    This is when I decided to write code to simulate the manual process - this doesnt work!

    Does the Sitefinity admin page use the same api call i am using?  Is there anything i am missing in the code?

    Thanks.
Register for webinar
3 posts, 0 answered