Beispiel #1
0
        public override IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDateUtc)
        {
            var controller      = new XmlBaseController(moduleInfo);
            var portalId        = moduleInfo.PortalID;
            var administratorId = PortalController.Instance.GetPortal(portalId).AdministratorId;

            var searchDocuments = new List <SearchDocument>();

            InternalSearchController.Instance.DeleteSearchDocumentsByModule(portalId, moduleInfo.ModuleID, moduleInfo.ModuleDefID);
            if (MustAddContentToSearch(moduleInfo))
            {
                var sw = new StringWriter();
                controller.Render(sw);
                sw.Flush();
                var content = sw.ToString();
                var now     = DateTime.Now;

                var searchDoc = new SearchDocument();
                searchDoc.Title           = moduleInfo.ModuleTitle;
                searchDoc.Description     = content;
                searchDoc.AuthorUserId    = administratorId;
                searchDoc.ModifiedTimeUtc = now;
                searchDoc.ModuleId        = moduleInfo.ModuleID;
                searchDoc.Body            = content;

                searchDocuments.Add(searchDoc);
            }
            return(searchDocuments);
        }
Beispiel #2
0
        ///<summary>
        ///  DotNetNuke Search support
        ///</summary>
        public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            var controller = new XmlBaseController(modInfo);

            var portalId        = modInfo.PortalID;
            var administratorId = new PortalController().GetPortal(portalId).AdministratorId;

            var searchItemCollection = new SearchItemInfoCollection();

            if (MustAddContentToSearch(modInfo))
            {
                var sw = new StringWriter();
                controller.Render(sw);
                sw.Flush();
                var content = sw.ToString();
                var now     = DateTime.Now;
                searchItemCollection.Add(new SearchItemInfo(modInfo.ModuleTitle, content, administratorId, now, modInfo.ModuleID, "", content));
                var mc = new ModuleController();
                mc.UpdateModuleSetting(modInfo.ModuleID, Setting.LastIndexRun, DateTime.Now.ToString("s"));
            }
            return(searchItemCollection);
        }