Example #1
0
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if (pageSettings == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("LinksIndexBuilderProvider.RebuildIndex error: pageSettings was null ");
                }
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info("LinksIndexBuilderProvider indexing page - "
                     + pageSettings.PageName);

            try
            {
                Guid             linksFeatureGuid = new Guid("5E52DEA6-7DE4-4bb7-B1CF-1324D4371956");
                ModuleDefinition linksFeature     = new ModuleDefinition(linksFeatureGuid);

                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                DataTable dataTable = Link.GetLinksByPage(
                    pageSettings.SiteId, pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    IndexItem indexItem = new IndexItem();
                    indexItem.SiteId          = pageSettings.SiteId;
                    indexItem.PageId          = pageSettings.PageId;
                    indexItem.PageName        = pageSettings.PageName;
                    indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = row["ViewRoles"].ToString();

                    if (pageSettings.UseUrl)
                    {
                        indexItem.ViewPage             = pageSettings.Url.Replace("~/", string.Empty);
                        indexItem.UseQueryStringParams = false;
                    }

                    indexItem.FeatureId           = linksFeatureGuid.ToString();
                    indexItem.FeatureName         = linksFeature.FeatureName;
                    indexItem.FeatureResourceFile = linksFeature.ResourceFile;

                    indexItem.ItemId      = Convert.ToInt32(row["ItemID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title       = row["Title"].ToString();
                    indexItem.Content     = row["Description"].ToString();
                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (log.IsDebugEnabled)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
Example #2
0
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            if (pageSettings == null)
            {
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info("GalleryImageIndexBuilderProvider indexing page - "
                     + pageSettings.PageName);

            try
            {
                Guid             galleryFeatureGuid = new Guid("d572f6b4-d0ed-465d-ad60-60433893b401");
                ModuleDefinition galleryFeature     = new ModuleDefinition(galleryFeatureGuid);

                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                DataTable dataTable = GalleryImage.GetImagesByPage(pageSettings.SiteId, pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                    indexItem.SiteId          = pageSettings.SiteId;
                    indexItem.PageId          = pageSettings.PageId;
                    indexItem.PageName        = pageSettings.PageName;
                    indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = row["ViewRoles"].ToString();

                    if (pageSettings.UseUrl)
                    {
                        indexItem.ViewPage             = pageSettings.Url.Replace("~/", string.Empty);
                        indexItem.UseQueryStringParams = false;
                    }
                    indexItem.FeatureId           = galleryFeatureGuid.ToString();
                    indexItem.FeatureName         = galleryFeature.FeatureName;
                    indexItem.FeatureResourceFile = galleryFeature.ResourceFile;

                    // TODO: it would be good to check the module settings and if not
                    // in compact mode use the GalleryBrowse.aspx page
                    //indexItem.ViewPage = "GalleryBrowse.aspx";

                    indexItem.ItemId      = Convert.ToInt32(row["ItemID"]);
                    indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"]);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title       = row["Caption"].ToString();
                    indexItem.Content     = row["Description"].ToString();

                    indexItem.QueryStringAddendum = "&ItemID"
                                                    + row["ModuleID"].ToString()
                                                    + "=" + row["ItemID"].ToString();

                    indexItem.CreatedUtc = Convert.ToDateTime(row["UploadDate"]);
                    indexItem.LastModUtc = indexItem.CreatedUtc;

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (debugLog)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
Example #3
0
        public override void RebuildIndex(PageSettings pageSettings, string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if (pageSettings == null)
            {
                log.Error("pageSettings object passed to BlogIndexBuilderProvider.RebuildIndex was null");
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info(BlogResources.BlogFeatureName + " indexing page - " + pageSettings.PageName);

            //try
            //{
            Guid             blogFeatureGuid = new Guid("026cbead-2b80-4491-906d-b83e37179ccf");
            ModuleDefinition blogFeature     = new ModuleDefinition(blogFeatureGuid);

            List <PageModule> pageModules
                = PageModule.GetPageModulesByPage(pageSettings.PageId);

            DataTable dataTable
                = Blog.GetBlogsByPage(
                      pageSettings.SiteId,
                      pageSettings.PageId);

            foreach (DataRow row in dataTable.Rows)
            {
                bool includeInSearch = Convert.ToBoolean(row["IncludeInSearch"], CultureInfo.InvariantCulture);
                if (!includeInSearch)
                {
                    continue;
                }

                DateTime postEndDate = DateTime.MaxValue;
                if (row["EndDate"] != DBNull.Value)
                {
                    postEndDate = Convert.ToDateTime(row["EndDate"]);

                    if (postEndDate < DateTime.UtcNow)
                    {
                        continue;
                    }
                }

                bool excludeFromRecentContent = Convert.ToBoolean(row["ExcludeFromRecentContent"], CultureInfo.InvariantCulture);

                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                indexItem.SiteId = pageSettings.SiteId;
                indexItem.PageId = pageSettings.PageId;
                indexItem.ExcludeFromRecentContent = excludeFromRecentContent;
                indexItem.PageName            = pageSettings.PageName;
                indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles     = row["ViewRoles"].ToString();
                indexItem.FeatureId           = blogFeatureGuid.ToString();
                indexItem.FeatureName         = blogFeature.FeatureName;
                indexItem.FeatureResourceFile = blogFeature.ResourceFile;

                indexItem.ItemId      = Convert.ToInt32(row["ItemID"], CultureInfo.InvariantCulture);
                indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture);
                indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                indexItem.Title       = row["Heading"].ToString();

                string authorName      = row["Name"].ToString();
                string authorFirstName = row["FirstName"].ToString();
                string authorLastName  = row["LastName"].ToString();

                if ((authorFirstName.Length > 0) && (authorLastName.Length > 0))
                {
                    indexItem.Author = string.Format(CultureInfo.InvariantCulture,
                                                     BlogResources.FirstLastFormat, authorFirstName, authorLastName);
                }
                else
                {
                    indexItem.Author = authorName;
                }

                if ((!WebConfigSettings.UseUrlReWriting) || (!BlogConfiguration.UseFriendlyUrls(indexItem.ModuleId)))
                {
                    indexItem.ViewPage = "Blog/ViewPost.aspx?pageid="
                                         + indexItem.PageId.ToInvariantString()
                                         + "&mid=" + indexItem.ModuleId.ToInvariantString()
                                         + "&ItemID=" + indexItem.ItemId.ToInvariantString()
                    ;
                }
                else
                {
                    indexItem.ViewPage = row["ItemUrl"].ToString().Replace("~/", string.Empty);
                }

                indexItem.PageMetaDescription = row["MetaDescription"].ToString();
                indexItem.PageMetaKeywords    = row["MetaKeywords"].ToString();

                DateTime blogStart = Convert.ToDateTime(row["StartDate"]);

                indexItem.CreatedUtc = blogStart;
                indexItem.LastModUtc = Convert.ToDateTime(row["LastModUtc"]);

                //if (indexItem.ViewPage.Length > 0)
                //{
                indexItem.UseQueryStringParams = false;
                //}
                //else
                //{
                //    indexItem.ViewPage = "Blog/ViewPost.aspx";
                //}
                indexItem.Content         = row["Description"].ToString();
                indexItem.ContentAbstract = row["Abstract"].ToString();
                int commentCount = Convert.ToInt32(row["CommentCount"]);

                if (commentCount > 0)
                {       // index comments
                    StringBuilder stringBuilder = new StringBuilder();
                    DataTable     comments      = Blog.GetBlogCommentsTable(indexItem.ModuleId, indexItem.ItemId);

                    foreach (DataRow commentRow in comments.Rows)
                    {
                        stringBuilder.Append("  " + commentRow["Comment"].ToString());
                        stringBuilder.Append("  " + commentRow["Name"].ToString());

                        if (debugLog)
                        {
                            log.Debug("BlogIndexBuilderProvider.RebuildIndex add comment ");
                        }
                    }

                    indexItem.OtherContent = stringBuilder.ToString();
                }

                // lookup publish dates
                foreach (PageModule pageModule in pageModules)
                {
                    if (indexItem.ModuleId == pageModule.ModuleId)
                    {
                        indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                        indexItem.PublishEndDate   = pageModule.PublishEndDate;
                    }
                }

                if (blogStart > indexItem.PublishBeginDate)
                {
                    indexItem.PublishBeginDate = blogStart;
                }
                if (postEndDate < indexItem.PublishEndDate)
                {
                    indexItem.PublishEndDate = postEndDate;
                }



                mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);

                if (debugLog)
                {
                    log.Debug("Indexed " + indexItem.Title);
                }
            }
            //}
            //catch (Exception ex)
            //{
            //    log.Error(ex);
            //}
        }
Example #4
0
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if ((pageSettings == null) || (indexPath == null))
            {
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info(Resources.SharedFileResources.SharedFilesFeatureName + " indexing page - " + pageSettings.PageName);

            try
            {
                Guid             sharedFilesFeatureGuid = new Guid("dc873d76-5bf2-4ac5-bff7-434a87a3fc8e");
                ModuleDefinition sharedFilesFeature     = new ModuleDefinition(sharedFilesFeatureGuid);

                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                DataTable dataTable = SharedFile.GetSharedFilesByPage(pageSettings.SiteId, pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                    indexItem.SiteId          = pageSettings.SiteId;
                    indexItem.PageId          = pageSettings.PageId;
                    indexItem.PageName        = pageSettings.PageName;
                    indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = row["ViewRoles"].ToString();
                    indexItem.CreatedUtc      = Convert.ToDateTime(row["UploadDate"]);
                    indexItem.LastModUtc      = indexItem.CreatedUtc;

                    //if (pageSettings.UseUrl)
                    //{
                    //    if (pageSettings.UrlHasBeenAdjustedForFolderSites)
                    //    {
                    //        indexItem.ViewPage = pageSettings.UnmodifiedUrl.Replace("~/", string.Empty);
                    //    }
                    //    else
                    //    {
                    //        indexItem.ViewPage = pageSettings.Url.Replace("~/", string.Empty);
                    //    }

                    //    indexItem.UseQueryStringParams = false;
                    //}

                    indexItem.FeatureId           = sharedFilesFeatureGuid.ToString();
                    indexItem.FeatureName         = sharedFilesFeature.FeatureName;
                    indexItem.FeatureResourceFile = sharedFilesFeature.ResourceFile;

                    indexItem.ItemId      = Convert.ToInt32(row["ItemID"]);
                    indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"]);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();

                    indexItem.Title   = row["FriendlyName"].ToString().Replace("_", " ").Replace("-", " ").Replace(".", " ");
                    indexItem.Content = row["Description"].ToString();

                    // make the search results a download link
                    indexItem.ViewPage = "SharedFiles/Download.aspx?pageid=" + indexItem.PageId.ToInvariantString()
                                         + "&fileid=" + indexItem.ItemId.ToInvariantString()
                                         + "&mid=" + indexItem.ModuleId.ToInvariantString();

                    indexItem.UseQueryStringParams = false;

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (debugLog)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
        /// <summary>
        /// This method is called when the site index is rebuilt
        /// </summary>
        /// <param name="pageSettings"></param>
        /// <param name="indexPath"></param>
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            if (pageSettings == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("pageSettings object passed to OfferSearchIndexBuilder.RebuildIndex was null");
                }
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info(Resources.WebStoreResources.WebStoreName + " indexing page - " + pageSettings.PageName);


            Guid             webStoreFeatureGuid = new Guid("0cefbf18-56de-11dc-8f36-bac755d89593");
            ModuleDefinition webStoreFeature     = new ModuleDefinition(webStoreFeatureGuid);

            List <PageModule> pageModules
                = PageModule.GetPageModulesByPage(pageSettings.PageId);

            // adding a try catch here because this is invoked even for non-implemented db platforms and it causes an error
            try
            {
                DataTable dataTable
                    = Offer.GetBySitePage(
                          pageSettings.SiteId,
                          pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                    indexItem.ModuleId = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture);

                    Hashtable             moduleSettings = ModuleSettings.GetModuleSettings(indexItem.ModuleId);
                    WebStoreConfiguration config         = new WebStoreConfiguration();
                    if (moduleSettings != null)
                    {
                        config = new WebStoreConfiguration(moduleSettings);
                    }

                    if (!config.IndexOffersInSearch)
                    {
                        continue;
                    }

                    indexItem.SiteId              = pageSettings.SiteId;
                    indexItem.PageId              = pageSettings.PageId;
                    indexItem.PageName            = pageSettings.PageName;
                    indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles     = row["ViewRoles"].ToString();
                    indexItem.FeatureId           = webStoreFeatureGuid.ToString();
                    indexItem.FeatureName         = webStoreFeature.FeatureName;
                    indexItem.FeatureResourceFile = webStoreFeature.ResourceFile;

                    indexItem.ItemKey = row["Guid"].ToString();

                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title       = row["Name"].ToString();
                    indexItem.ViewPage    = row["Url"].ToString().Replace("/", string.Empty);

                    if (indexItem.ViewPage.Length > 0)
                    {
                        indexItem.UseQueryStringParams = false;
                    }
                    else
                    {
                        indexItem.ViewPage = "WebStore/OfferDetail.aspx";
                    }

                    indexItem.PageMetaDescription = row["MetaDescription"].ToString();
                    indexItem.PageMetaKeywords    = row["MetaKeywords"].ToString();

                    indexItem.CreatedUtc = Convert.ToDateTime(row["Created"]);
                    indexItem.LastModUtc = Convert.ToDateTime(row["LastModified"]);

                    indexItem.Content = row["Abstract"].ToString()
                                        + " " + row["Description"].ToString()
                                        + " " + row["MetaDescription"].ToString()
                                        + " " + row["MetaKeywords"].ToString();


                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);


                    if (debugLog)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch { }
        }
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if ((pageSettings == null) || (indexPath == null))
            {
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info("SharedFilesIndexBuilderProvider indexing page - "
                     + pageSettings.PageName);

            try
            {
                Guid             sharedFilesFeatureGuid = new Guid("2BCF0FF5-226A-480b-9795-2F343593365C");
                ModuleDefinition sharedFilesFeature     = new ModuleDefinition(sharedFilesFeatureGuid);

                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                DataTable dataTable = SharedFile.GetSharedFilesByPage(pageSettings.SiteId, pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    IndexItem indexItem = new IndexItem();
                    indexItem.SiteId          = pageSettings.SiteId;
                    indexItem.PageId          = pageSettings.PageId;
                    indexItem.PageName        = pageSettings.PageName;
                    indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = row["ViewRoles"].ToString();

                    if (pageSettings.UseUrl)
                    {
                        indexItem.ViewPage             = pageSettings.Url.Replace("~/", string.Empty);
                        indexItem.UseQueryStringParams = false;
                    }

                    indexItem.FeatureId           = sharedFilesFeatureGuid.ToString();
                    indexItem.FeatureName         = sharedFilesFeature.FeatureName;
                    indexItem.FeatureResourceFile = sharedFilesFeature.ResourceFile;

                    indexItem.ItemId      = Convert.ToInt32(row["ItemID"]);
                    indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"]);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title       = row["FriendlyName"].ToString();
                    indexItem.Content     = row["Description"].ToString();

                    // make the search results a download link
                    indexItem.ViewPage = "SharedFiles/Download.aspx?pageid=" + indexItem.PageId.ToInvariantString()
                                         + "&fileid=" + indexItem.ItemId.ToInvariantString()
                                         + "&mid=" + indexItem.ModuleId.ToInvariantString();

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (log.IsDebugEnabled)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
Example #7
0
        public override void RebuildIndex(PageSettings pageSettings, string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if ((pageSettings == null) || (indexPath == null))
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("pageSettings object or index path passed to KalturaIndexBuilderProvider.RebuildIndex was null");
                }
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info("KalturaIndexBuilderProvider indexing page - " + pageSettings.PageName);

            try
            {
                List <PageModule> pageModules = PageModule.GetPageModulesByPage(pageSettings.PageId);

                //1. Get Century21_Kaltura_PlayVideos data from mp_ModuleDefinitions table using GUID
                Guid             kalturaVideoGuid = new Guid("40C79626-E229-4CBA-B9B1-52745734FE44");
                ModuleDefinition forumFeature     = new ModuleDefinition(kalturaVideoGuid);
                //2. Get all Kaltura videos which are saved in Usr_TblKalturaVideo table
                List <KalturaVideoNotification> lstVideos = KalturaVideoNotification.GetKalturaVideoByPage(pageSettings.SiteId, pageSettings.PageId);
                foreach (KalturaVideoNotification video in lstVideos)
                {
                    IndexItem indexItem = new IndexItem();
                    indexItem.SiteId          = pageSettings.SiteId;
                    indexItem.PageId          = pageSettings.PageId;
                    indexItem.PageName        = pageSettings.PageName;
                    indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = video.ViewRoles;

                    indexItem.FeatureName         = forumFeature.FeatureName;
                    indexItem.FeatureResourceFile = forumFeature.ResourceFile;

                    indexItem.ItemId       = video.KalturaVideoID;
                    indexItem.ModuleId     = video.ModuleID;
                    indexItem.ModuleTitle  = "Play Videos";
                    indexItem.Title        = video.Name;
                    indexItem.Content      = video.Description + " --&gt; " + video.Tags;
                    indexItem.OtherContent = video.ThumnailURL;
                    indexItem.ViewPage     = "/play-video?mediaId=" + video.EntryId;

                    var pageModule = pageModules.Where(p => p.ModuleId == indexItem.ModuleId).FirstOrDefault();
                    if (pageModule != null)
                    {
                        indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                        indexItem.PublishEndDate   = pageModule.PublishEndDate;
                    }

                    IndexHelper.RebuildIndex(indexItem, indexPath);
                    if (debugLog)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
Example #8
0
        /// <summary> Rebuilds the index. </summary>
        /// <param name="pageSettings"> The page settings. </param>
        /// <param name="indexPath"> The index path. </param>
        public override void RebuildIndex(PageSettings pageSettings, string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            if (pageSettings == null)
            {
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            Log.Info("ReservationEventIndexBuilderProvider indexing page - " + pageSettings.PageName);

            try
            {
                var reservationFeature = new ModuleDefinition(reservationFeatureGuid);
                var pageModules        = PageModule.GetPageModulesByPage(pageSettings.PageId);
                var dataTable          = ReservationEvent.GetEventsByPage(pageSettings.SiteId, pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    var indexItem = new IndexItem
                    {
                        SiteId              = pageSettings.SiteId,
                        PageId              = pageSettings.PageId,
                        PageName            = pageSettings.PageName,
                        PageIndex           = pageSettings.PageIndex,
                        ViewRoles           = pageSettings.AuthorizedRoles,
                        ModuleViewRoles     = row["ViewRoles"].ToString(),
                        FeatureId           = reservationFeatureGuid.ToString(),
                        FeatureName         = reservationFeature.FeatureName,
                        FeatureResourceFile = reservationFeature.ResourceFile,
                        ItemId              = Convert.ToInt32(row["ItemID"], CultureInfo.InvariantCulture),
                        ModuleId            = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture),
                        ModuleTitle         = row["ModuleTitle"].ToString(),
                        Title      = row["Title"].ToString(),
                        Content    = row["Description"].ToString(),
                        ViewPage   = "Reservations/Details.aspx",
                        CreatedUtc = Convert.ToDateTime(row["CreatedDate"]),
                        LastModUtc = Convert.ToDateTime(row["LastModUtc"])
                    };

                    // lookup publish dates
                    foreach (var pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (Log.IsDebugEnabled)
                    {
                        Log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                Log.Error(ex);
            }
        }
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            if (pageSettings == null)
            {
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info("CalendarEventIndexBuilderProvider indexing page - "
                     + pageSettings.PageName);

            try
            {
                Guid             calendarFeatureGuid = new Guid("71183E1F-FBCD-4d00-98DC-F1FC17522199");
                ModuleDefinition calendarFeature     = new ModuleDefinition(calendarFeatureGuid);

                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                DataTable dataTable = CalendarEvent.GetEventsByPage(pageSettings.SiteId, pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    IndexItem indexItem = new IndexItem();
                    indexItem.SiteId              = pageSettings.SiteId;
                    indexItem.PageId              = pageSettings.PageId;
                    indexItem.PageName            = pageSettings.PageName;
                    indexItem.PageIndex           = pageSettings.PageIndex;
                    indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles     = row["ViewRoles"].ToString();
                    indexItem.FeatureId           = calendarFeatureGuid.ToString();
                    indexItem.FeatureName         = calendarFeature.FeatureName;
                    indexItem.FeatureResourceFile = calendarFeature.ResourceFile;

                    indexItem.ItemId      = Convert.ToInt32(row["ItemID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title       = row["Title"].ToString();
                    indexItem.Content     = row["Description"].ToString();
                    indexItem.ViewPage    = "EventCalendar/EventDetails.aspx";

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (log.IsDebugEnabled)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
Example #10
0
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if ((pageSettings == null) || (indexPath == null))
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("pageSettings object or index path passed to BrowseCoursesIndexBuilderProvider.RebuildIndex was null");
                }
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info("BrowseCoursesIndexBuilderProvider indexing page - "
                     + pageSettings.PageName);

            try
            {
                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                Guid             scheduleFeatureGuid = new Guid("dc873d76-5bf2-4ac5-bff7-434a86a3fc9e");
                ModuleDefinition forumFeature        = new ModuleDefinition(scheduleFeatureGuid);



                List <CourseModule> lstSchedules = CourseModule.GetCoursesByPage(pageSettings.SiteId, pageSettings.PageId);
                DataTable           dataTable    = ConvertToDatatable(lstSchedules);

                foreach (DataRow row in dataTable.Rows)
                {
                    mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                    indexItem.SiteId              = pageSettings.SiteId;
                    indexItem.PageId              = pageSettings.PageId;
                    indexItem.PageName            = pageSettings.PageName;
                    indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles     = row["ViewRoles"].ToString();
                    indexItem.FeatureId           = scheduleFeatureGuid.ToString();
                    indexItem.FeatureName         = forumFeature.FeatureName;
                    indexItem.FeatureResourceFile = forumFeature.ResourceFile;

                    indexItem.ItemId      = Convert.ToInt32(row["CourseID"]);
                    indexItem.ModuleId    = Convert.ToInt32(row["ModuleId"]);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title       = row["CourseName"].ToString();
                    indexItem.Content     = row["Description"].ToString() + " " + row["Metatags"].ToString() + " " + row["LeadInstructor"].ToString();
                    indexItem.ViewPage    = WebConfigSettings.CourseSearchUrl; //"browse-course";


                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    //indexItem.PublishBeginDate = Convert.ToDateTime(row["PostDate"]);
                    //indexItem.PublishEndDate = DateTime.MaxValue;

                    mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (debugLog)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            bool disableSearchIndex = ConfigHelper.GetBoolProperty("DisableSearchIndex", false);

            if (disableSearchIndex)
            {
                return;
            }

            if (pageSettings == null)
            {
                log.Error("pageSettings passed in to HtmlContentIndexBuilderProvider.RebuildIndex was null");
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info("HtmlContentIndexBuilderProvider indexing page - "
                     + pageSettings.PageName);

            try
            {
                Guid htmlFeatureGuid
                    = new Guid("113FB01C-6408-4607-B0F7-1379E2512396");
                ModuleDefinition htmlFeature
                    = new ModuleDefinition(htmlFeatureGuid);

                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                HtmlRepository repository = new HtmlRepository();

                DataTable dataTable = repository.GetHtmlContentByPage(
                    pageSettings.SiteId,
                    pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    IndexItem indexItem = new IndexItem();
                    indexItem.SiteId   = pageSettings.SiteId;
                    indexItem.PageId   = pageSettings.PageId;
                    indexItem.PageName = pageSettings.PageName;

                    // generally we should not include the page meta because it can result in duplicate results
                    // one for each instance of html content on the page because they all use the smae page meta.
                    // since page meta should reflect the content of the page it is sufficient to just index the content
                    if ((ConfigurationManager.AppSettings["IndexPageMeta"] != null) && (ConfigurationManager.AppSettings["IndexPageMeta"] == "true"))
                    {
                        indexItem.PageMetaDescription = pageSettings.PageMetaDescription;
                        indexItem.PageMetaKeywords    = pageSettings.PageMetaKeyWords;
                    }

                    indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = row["ViewRoles"].ToString();
                    if (pageSettings.UseUrl)
                    {
                        indexItem.ViewPage             = pageSettings.Url.Replace("~/", string.Empty);
                        indexItem.UseQueryStringParams = false;
                    }
                    indexItem.FeatureId           = htmlFeatureGuid.ToString();
                    indexItem.FeatureName         = htmlFeature.FeatureName;
                    indexItem.FeatureResourceFile = htmlFeature.ResourceFile;

                    indexItem.ItemId      = Convert.ToInt32(row["ItemID"]);
                    indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"]);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title       = row["Title"].ToString();
                    // added the remove markup 2010-01-30 because some javascript strings like ]]> were apearing in search results if the content conatined jacvascript
                    indexItem.Content = SecurityHelper.RemoveMarkup(row["Body"].ToString());

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    IndexHelper.RebuildIndex(indexItem, indexPath);

                    log.Debug("Indexed " + indexItem.Title);
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if (pageSettings == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("pageSettings object passed to BlogIndexBuilderProvider.RebuildIndex was null");
                }
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info("BlogIndexBuilderProvider indexing page - "
                     + pageSettings.PageName);

            //try
            //{
            Guid             blogFeatureGuid = new Guid("D1D86E30-7864-40fe-BCBF-46E77AF80342");
            ModuleDefinition blogFeature     = new ModuleDefinition(blogFeatureGuid);

            List <PageModule> pageModules
                = PageModule.GetPageModulesByPage(pageSettings.PageId);

            DataTable dataTable
                = Blog.GetBlogsByPage(
                      pageSettings.SiteId,
                      pageSettings.PageId);

            foreach (DataRow row in dataTable.Rows)
            {
                IndexItem indexItem = new IndexItem();
                indexItem.SiteId              = pageSettings.SiteId;
                indexItem.PageId              = pageSettings.PageId;
                indexItem.PageName            = pageSettings.PageName;
                indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles     = row["ViewRoles"].ToString();
                indexItem.FeatureId           = blogFeatureGuid.ToString();
                indexItem.FeatureName         = blogFeature.FeatureName;
                indexItem.FeatureResourceFile = blogFeature.ResourceFile;

                indexItem.ItemId      = Convert.ToInt32(row["ItemID"], CultureInfo.InvariantCulture);
                indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture);
                indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                indexItem.Title       = row["Title"].ToString();
                indexItem.ViewPage    = row["ItemUrl"].ToString().Replace("~/", string.Empty);

                indexItem.PageMetaDescription = row["MetaDescription"].ToString();
                indexItem.PageMetaKeywords    = row["MetaKeywords"].ToString();

                DateTime blogStart = Convert.ToDateTime(row["StartDate"]);

                if (indexItem.ViewPage.Length > 0)
                {
                    indexItem.UseQueryStringParams = false;
                }
                else
                {
                    indexItem.ViewPage = "Blog/ViewPost.aspx";
                }
                indexItem.Content = row["Description"].ToString();
                int commentCount = Convert.ToInt32(row["CommentCount"]);

                if (commentCount > 0)
                {       // index comments
                    StringBuilder stringBuilder = new StringBuilder();
                    DataTable     comments      = Blog.GetBlogCommentsTable(indexItem.ModuleId, indexItem.ItemId);

                    foreach (DataRow commentRow in comments.Rows)
                    {
                        stringBuilder.Append("  " + commentRow["Comment"].ToString());
                        stringBuilder.Append("  " + commentRow["Name"].ToString());

                        if (log.IsDebugEnabled)
                        {
                            log.Debug("BlogIndexBuilderProvider.RebuildIndex add comment ");
                        }
                    }

                    indexItem.OtherContent = stringBuilder.ToString();
                }

                // lookup publish dates
                foreach (PageModule pageModule in pageModules)
                {
                    if (indexItem.ModuleId == pageModule.ModuleId)
                    {
                        indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                        indexItem.PublishEndDate   = pageModule.PublishEndDate;
                    }
                }

                if (blogStart > indexItem.PublishBeginDate)
                {
                    indexItem.PublishBeginDate = blogStart;
                }



                IndexHelper.RebuildIndex(indexItem, indexPath);

                if (log.IsDebugEnabled)
                {
                    log.Debug("Indexed " + indexItem.Title);
                }
            }
            //}
            //catch (Exception ex)
            //{
            //    log.Error(ex);
            //}
        }
Example #13
0
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if ((pageSettings == null) || (indexPath == null))
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("pageSettings object or index path passed to GroupTopicIndexBuilderProvider.RebuildIndex was null");
                }
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info("GroupTopicIndexBuilderProvider indexing page - "
                     + pageSettings.PageName);

            try
            {
                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                Guid             groupFeatureGuid = new Guid("E75BAF8C-7079-4d10-A122-1AA3624E26F2");
                ModuleDefinition groupFeature     = new ModuleDefinition(groupFeatureGuid);

                DataTable dataTable = GroupTopic.GetPostsByPage(
                    pageSettings.SiteId,
                    pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    IndexItem indexItem = new IndexItem();
                    indexItem.SiteId              = pageSettings.SiteId;
                    indexItem.PageId              = pageSettings.PageId;
                    indexItem.PageName            = pageSettings.PageName;
                    indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles     = row["ViewRoles"].ToString();
                    indexItem.FeatureId           = groupFeatureGuid.ToString();
                    indexItem.FeatureName         = groupFeature.FeatureName;
                    indexItem.FeatureResourceFile = groupFeature.ResourceFile;

                    indexItem.ItemId              = Convert.ToInt32(row["ItemID"]);
                    indexItem.ModuleId            = Convert.ToInt32(row["ModuleID"]);
                    indexItem.ModuleTitle         = row["ModuleTitle"].ToString();
                    indexItem.Title               = row["Subject"].ToString();
                    indexItem.Content             = row["Post"].ToString();
                    indexItem.ViewPage            = "Groups/Topic.aspx";
                    indexItem.QueryStringAddendum = "&topic="
                                                    + row["TopicID"].ToString()
                                                    + "&postid=" + row["PostID"].ToString();

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (log.IsDebugEnabled)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if (pageSettings == null)
            {
                log.Error("LinksIndexBuilderProvider.RebuildIndex error: pageSettings was null ");
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info(LinkResources.FeatureName + " indexing page - " + pageSettings.PageName);

            try
            {
                Guid             linksFeatureGuid = new Guid("74bdbcc2-0e79-47ff-bcd4-a159270bf36e");
                ModuleDefinition linksFeature     = new ModuleDefinition(linksFeatureGuid);

                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                DataTable dataTable = Link.GetLinksByPage(
                    pageSettings.SiteId, pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                    indexItem.SiteId          = pageSettings.SiteId;
                    indexItem.PageId          = pageSettings.PageId;
                    indexItem.PageName        = pageSettings.PageName;
                    indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = row["ViewRoles"].ToString();
                    indexItem.CreatedUtc      = Convert.ToDateTime(row["CreatedDate"]);
                    indexItem.LastModUtc      = indexItem.CreatedUtc;

                    if (pageSettings.UseUrl)
                    {
                        if (pageSettings.UrlHasBeenAdjustedForFolderSites)
                        {
                            indexItem.ViewPage = pageSettings.UnmodifiedUrl.Replace("~/", string.Empty);
                        }
                        else
                        {
                            indexItem.ViewPage = pageSettings.Url.Replace("~/", string.Empty);
                        }
                        indexItem.UseQueryStringParams = false;
                    }

                    indexItem.FeatureId           = linksFeatureGuid.ToString();
                    indexItem.FeatureName         = linksFeature.FeatureName;
                    indexItem.FeatureResourceFile = linksFeature.ResourceFile;

                    indexItem.ItemId      = Convert.ToInt32(row["ItemID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title       = row["Title"].ToString();
                    indexItem.Content     = row["Description"].ToString();
                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (debugLog)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if ((pageSettings == null) || (indexPath == null))
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("pageSettings object or index path passed to ForumThreadIndexBuilderProvider.RebuildIndex was null");
                }
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info("ForumThreadIndexBuilderProvider indexing page - "
                     + pageSettings.PageName);

            try
            {
                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                Guid             forumFeatureGuid = new Guid("38aa5a84-9f5c-42eb-8f4c-105983d419fb");
                ModuleDefinition forumFeature     = new ModuleDefinition(forumFeatureGuid);

                // new implementation 2012-05-22: get threads by page, then for each thread concat the posts into one item for indexing
                // previously were indexing individual posts but this makes multiple results in search results for the same thread

                if (ForumConfiguration.AggregateSearchIndexPerThread)
                {
                    DataTable threads = ForumThread.GetThreadsByPage(
                        pageSettings.SiteId,
                        pageSettings.PageId);



                    foreach (DataRow row in threads.Rows)
                    {
                        StringBuilder threadContent = new StringBuilder();

                        int      threadId   = Convert.ToInt32(row["ThreadID"]);
                        DateTime threadDate = Convert.ToDateTime(row["ThreadDate"]);

                        DataTable threadPosts = ForumThread.GetPostsByThread(threadId);



                        foreach (DataRow r in threadPosts.Rows)
                        {
                            threadContent.Append(r["Post"].ToString());
                        }

                        mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();

                        // lookup publish dates
                        foreach (PageModule pageModule in pageModules)
                        {
                            if (indexItem.ModuleId == pageModule.ModuleId)
                            {
                                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                                indexItem.PublishEndDate   = pageModule.PublishEndDate;
                            }
                        }

                        indexItem.CreatedUtc = threadDate;

                        if (row["MostRecentPostDate"] != DBNull.Value)
                        {
                            indexItem.LastModUtc = Convert.ToDateTime(row["MostRecentPostDate"]);
                        }
                        else
                        {
                            indexItem.LastModUtc = threadDate;
                        }



                        indexItem.SiteId              = pageSettings.SiteId;
                        indexItem.PageId              = pageSettings.PageId;
                        indexItem.PageName            = pageSettings.PageName;
                        indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                        indexItem.ModuleViewRoles     = row["ViewRoles"].ToString();
                        indexItem.FeatureId           = forumFeatureGuid.ToString();
                        indexItem.FeatureName         = forumFeature.FeatureName;
                        indexItem.FeatureResourceFile = forumFeature.ResourceFile;

                        indexItem.ItemId      = Convert.ToInt32(row["ItemID"]);
                        indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"]);
                        indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                        indexItem.Title       = row["Subject"].ToString();

                        indexItem.Content = threadContent.ToString();

                        if (ForumConfiguration.CombineUrlParams)
                        {
                            indexItem.ViewPage = "Forums/Thread.aspx?pageid=" + pageSettings.PageId.ToInvariantString()
                                                 + "&t=" + row["ThreadID"].ToString() + "~1";
                            indexItem.UseQueryStringParams = false;
                            // still need this since it is aprt of the key
                            indexItem.QueryStringAddendum = "&thread=" + row["ThreadID"].ToString();
                        }
                        else
                        {
                            indexItem.ViewPage            = "Forums/Thread.aspx";
                            indexItem.QueryStringAddendum = "&thread=" + row["ThreadID"].ToString();
                        }



                        mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);

                        if (debugLog)
                        {
                            log.Debug("Indexed " + indexItem.Title);
                        }
                    }
                }
                else
                {
                    //older implementation indexed posts individually

                    DataTable dataTable = ForumThread.GetPostsByPage(
                        pageSettings.SiteId,
                        pageSettings.PageId);

                    foreach (DataRow row in dataTable.Rows)
                    {
                        mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                        indexItem.SiteId              = pageSettings.SiteId;
                        indexItem.PageId              = pageSettings.PageId;
                        indexItem.PageName            = pageSettings.PageName;
                        indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                        indexItem.ModuleViewRoles     = row["ViewRoles"].ToString();
                        indexItem.FeatureId           = forumFeatureGuid.ToString();
                        indexItem.FeatureName         = forumFeature.FeatureName;
                        indexItem.FeatureResourceFile = forumFeature.ResourceFile;

                        indexItem.ItemId              = Convert.ToInt32(row["ItemID"]);
                        indexItem.ModuleId            = Convert.ToInt32(row["ModuleID"]);
                        indexItem.ModuleTitle         = row["ModuleTitle"].ToString();
                        indexItem.Title               = row["Subject"].ToString();
                        indexItem.Content             = row["Post"].ToString();
                        indexItem.ViewPage            = "Forums/Thread.aspx";
                        indexItem.QueryStringAddendum = "&thread="
                                                        + row["ThreadID"].ToString()
                                                        + "&postid=" + row["PostID"].ToString();

                        // lookup publish dates
                        foreach (PageModule pageModule in pageModules)
                        {
                            if (indexItem.ModuleId == pageModule.ModuleId)
                            {
                                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                                indexItem.PublishEndDate   = pageModule.PublishEndDate;
                            }
                        }

                        //indexItem.PublishBeginDate = Convert.ToDateTime(row["PostDate"]);
                        //indexItem.PublishEndDate = DateTime.MaxValue;

                        mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);

                        if (debugLog)
                        {
                            log.Debug("Indexed " + indexItem.Title);
                        }
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            bool disableSearchIndex = ConfigHelper.GetBoolProperty("DisableSearchIndex", false);

            if (disableSearchIndex)
            {
                return;
            }

            if (pageSettings == null)
            {
                log.Error("pageSettings passed in to HtmlContentIndexBuilderProvider.RebuildIndex was null");
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info(Resource.HtmlContentFeatureName + " indexing page - " + pageSettings.PageName);

            try
            {
                Guid htmlFeatureGuid
                    = new Guid("881e4e00-93e4-444c-b7b0-6672fb55de10");
                ModuleDefinition htmlFeature
                    = new ModuleDefinition(htmlFeatureGuid);

                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                HtmlRepository repository = new HtmlRepository();

                DataTable dataTable = repository.GetHtmlContentByPage(
                    pageSettings.SiteId,
                    pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    bool includeInSearch          = Convert.ToBoolean(row["IncludeInSearch"]);
                    bool excludeFromRecentContent = Convert.ToBoolean(row["ExcludeFromRecentContent"]);

                    IndexItem indexItem = new IndexItem();
                    indexItem.ExcludeFromRecentContent = excludeFromRecentContent;
                    indexItem.SiteId   = pageSettings.SiteId;
                    indexItem.PageId   = pageSettings.PageId;
                    indexItem.PageName = pageSettings.PageName;

                    string authorName      = row["CreatedByName"].ToString();
                    string authorFirstName = row["CreatedByFirstName"].ToString();
                    string authorLastName  = row["CreatedByLastName"].ToString();

                    if ((authorFirstName.Length > 0) && (authorLastName.Length > 0))
                    {
                        indexItem.Author = string.Format(CultureInfo.InvariantCulture,
                                                         Resource.FirstNameLastNameFormat, authorFirstName, authorLastName);
                    }
                    else
                    {
                        indexItem.Author = authorName;
                    }

                    if (!includeInSearch)
                    {
                        indexItem.RemoveOnly = true;
                    }

                    // generally we should not include the page meta because it can result in duplicate results
                    // one for each instance of html content on the page because they all use the smae page meta.
                    // since page meta should reflect the content of the page it is sufficient to just index the content
                    if (WebConfigSettings.IndexPageKeywordsWithHtmlArticleContent)
                    {
                        indexItem.PageMetaDescription = pageSettings.PageMetaDescription;
                        indexItem.PageMetaKeywords    = pageSettings.PageMetaKeyWords;
                    }

                    indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = row["ViewRoles"].ToString();
                    if (pageSettings.UseUrl)
                    {
                        if (pageSettings.UrlHasBeenAdjustedForFolderSites)
                        {
                            indexItem.ViewPage = pageSettings.UnmodifiedUrl.Replace("~/", string.Empty);
                        }
                        else
                        {
                            indexItem.ViewPage = pageSettings.Url.Replace("~/", string.Empty);
                        }
                        indexItem.UseQueryStringParams = false;
                    }
                    indexItem.FeatureId           = htmlFeatureGuid.ToString();
                    indexItem.FeatureName         = htmlFeature.FeatureName;
                    indexItem.FeatureResourceFile = htmlFeature.ResourceFile;

                    indexItem.ItemId      = Convert.ToInt32(row["ItemID"]);
                    indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"]);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title       = row["Title"].ToString();
                    // added the remove markup 2010-01-30 because some javascript strings like ]]> were apearing in search results if the content conatined jacvascript
                    indexItem.Content = SecurityHelper.RemoveMarkup(row["Body"].ToString());

                    indexItem.CreatedUtc = Convert.ToDateTime(row["CreatedDate"]);
                    indexItem.LastModUtc = Convert.ToDateTime(row["LastModUtc"]);

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    IndexHelper.RebuildIndex(indexItem, indexPath);

                    log.Debug("Indexed " + indexItem.Title);
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            if (pageSettings == null)
            {
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending)
            {
                return;
            }

            log.Info(Resources.EventCalResources.EventCalendarFeatureName + " indexing page - " + pageSettings.PageName);

            try
            {
                Guid             calendarFeatureGuid = new Guid("c5e6a5df-ac2a-43d3-bb7f-9739bc47194e");
                ModuleDefinition calendarFeature     = new ModuleDefinition(calendarFeatureGuid);

                List <PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

                DataTable dataTable = CalendarEvent.GetEventsByPage(pageSettings.SiteId, pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                    indexItem.SiteId              = pageSettings.SiteId;
                    indexItem.PageId              = pageSettings.PageId;
                    indexItem.PageName            = pageSettings.PageName;
                    indexItem.PageIndex           = pageSettings.PageIndex;
                    indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles     = row["ViewRoles"].ToString();
                    indexItem.FeatureId           = calendarFeatureGuid.ToString();
                    indexItem.FeatureName         = calendarFeature.FeatureName;
                    indexItem.FeatureResourceFile = calendarFeature.ResourceFile;

                    indexItem.ItemId      = Convert.ToInt32(row["ItemID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleId    = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title       = row["Title"].ToString();
                    indexItem.Content     = row["Description"].ToString();
                    indexItem.ViewPage    = "EventCalendar/EventDetails.aspx";

                    indexItem.CreatedUtc = Convert.ToDateTime(row["CreatedDate"]);
                    indexItem.LastModUtc = Convert.ToDateTime(row["LastModUtc"]);

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate   = pageModule.PublishEndDate;
                        }
                    }

                    mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (debugLog)
                    {
                        log.Debug("Indexed " + indexItem.Title);
                    }
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }