コード例 #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets all the Searchable Module MetaData SearchDocuments within the timeframe for all portals
        /// </summary>
        /// -----------------------------------------------------------------------------
        private int GetAndStoreModuleMetaData(ModuleIndexer indexer)
        {
            IEnumerable <SearchDocument> searchDocs;
            var      portals = PortalController.Instance.GetPortals();
            DateTime indexSince;
            var      indexedCount = 0;

            //DateTime startDate

            foreach (var portal in portals.Cast <PortalInfo>())
            {
                indexSince = FixedIndexingStartDate(portal.PortalID);
                searchDocs = indexer.GetModuleMetaData(portal.PortalID, indexSince);
                StoreSearchDocuments(searchDocs);
                indexedCount += searchDocs.Count();
            }

            // Include Host Level Items
            indexSince = FixedIndexingStartDate(Null.NullInteger);
            searchDocs = indexer.GetModuleMetaData(Null.NullInteger, indexSince);
            StoreSearchDocuments(searchDocs);
            indexedCount += searchDocs.Count();

            return(indexedCount);
        }
コード例 #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Indexes content within the given time farame
        /// </summary>
        /// -----------------------------------------------------------------------------
        internal void IndexContent()
        {
            //Index TAB META-DATA
            var tabIndexer                 = new TabIndexer();
            var searchDocsCount            = GetAndStoreSearchDocuments(tabIndexer);
            var indexedSearchDocumentCount = searchDocsCount;

            AddIdexingResults("Tabs Indexed", searchDocsCount);

            //Index MODULE META-DATA from modules that inherit from ModuleSearchBase
            var moduleIndexer = new ModuleIndexer(true);

            searchDocsCount             = GetAndStoreModuleMetaData(moduleIndexer);
            indexedSearchDocumentCount += searchDocsCount;
            AddIdexingResults("Modules (Metadata) Indexed", searchDocsCount);

            //Index MODULE CONTENT from modules that inherit from ModuleSearchBase
            searchDocsCount             = GetAndStoreSearchDocuments(moduleIndexer);
            indexedSearchDocumentCount += searchDocsCount;

            //Both ModuleSearchBase and ISearchable module content count
            AddIdexingResults("Modules (Content) Indexed", searchDocsCount);

            if (!HostController.Instance.GetBoolean("DisableUserCrawling", false))
            {
                //Index User data
                var userIndexer = new UserIndexer();
                var userIndexed = GetAndStoreSearchDocuments(userIndexer);
                indexedSearchDocumentCount += userIndexed;
                AddIdexingResults("Users", userIndexed);
            }

            SchedulerItem.AddLogNote("<br/><b>Total Items Indexed: " + indexedSearchDocumentCount + "</b>");
        }
コード例 #3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// StoreSearchItems adds the Search Item to the Data Store
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="searchItems">A Collection of SearchItems</param>
        public override void StoreSearchItems(SearchItemInfoCollection searchItems)
        {
            var indexer = new ModuleIndexer();

            var modulesDic = new Dictionary <int, string>();

            foreach (SearchItemInfo item in searchItems)
            {
                if (!modulesDic.ContainsKey(item.ModuleId))
                {
                    var module = ModuleController.Instance.GetModule(item.ModuleId, Null.NullInteger, true);
                    modulesDic.Add(item.ModuleId, module.CultureCode);

                    //Remove all indexed items for this module
                    InternalSearchController.Instance.DeleteSearchDocumentsByModule(module.PortalID, module.ModuleID, module.ModuleDefID);
                }
            }

            //Process the SearchItems by Module to reduce Database hits
            foreach (var kvp in modulesDic)
            {
                //Get the Module's SearchItems
                var moduleSearchItems = searchItems.ModuleItems(kvp.Key);

                //Convert SearchItemInfo objects to SearchDocument objects
                var searchDocuments = (from SearchItemInfo item in moduleSearchItems select indexer.ConvertSearchItemInfoToSearchDocument(item)).ToList();

                //Index
                InternalSearchController.Instance.AddSearchDocuments(searchDocuments);
            }
        }
コード例 #4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Indexes content within the given time farame
        /// </summary>
        /// <param name="startDate"></param>
        /// <history>
        ///     [vnguyen]   04/17/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        internal void IndexContent(DateTime startDate)
        {
            var tabIndexer    = new TabIndexer();
            var moduleIndexer = new ModuleIndexer();
            var userIndexer   = new UserIndexer();

            IndexedSearchDocumentCount = 0;
            Results = new Dictionary <string, int>();

            //Index TAB META-DATA
            var searchDocs      = GetSearchDocuments(tabIndexer, startDate);
            var searchDocuments = searchDocs as IList <SearchDocument> ?? searchDocs.ToList();

            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();
            Results.Add("Tabs", searchDocuments.Count());

            //Index MODULE META-DATA from modules that inherit from ModuleSearchBase
            searchDocs      = GetModuleMetaData(startDate);
            searchDocuments = searchDocs as IList <SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();
            Results.Add("Modules (Metadata)", searchDocuments.Count());

            //Index MODULE CONTENT from modules that inherit from ModuleSearchBase
            searchDocs      = GetSearchDocuments(moduleIndexer, startDate);
            searchDocuments = searchDocs as IList <SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();

            #pragma warning disable 0618
            //Index all Defunct ISearchable module content
            var searchItems = GetContent(moduleIndexer);
            SearchDataStoreProvider.Instance().StoreSearchItems(searchItems);
            #pragma warning restore 0618
            IndexedSearchDocumentCount += searchItems.Count;

            //Both ModuleSearchBase and ISearchable module content count
            Results.Add("Modules (Content)", searchDocuments.Count() + searchItems.Count);

            //Index User data
            if (HostController.Instance.GetBoolean("DisableUserCrawling", false))
            {
                return;
            }
            searchDocs      = GetSearchDocuments(userIndexer, startDate);
            searchDocuments = searchDocs as IList <SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            var userIndexed =
                searchDocuments.Select(
                    d => d.UniqueKey.Substring(0, d.UniqueKey.IndexOf("_", StringComparison.Ordinal)))
                .Distinct()
                .Count();
            IndexedSearchDocumentCount += userIndexed;
            Results.Add("Users", userIndexed);
        }
コード例 #5
0
ファイル: SearchEngine.cs プロジェクト: fmenci/Dnn.Platform
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets all the Searchable Module MetaData SearchDocuments within the timeframe for the given portal
        /// </summary>
        /// <param name="portalId"></param>
        /// <param name="startDate"></param>
        /// <returns></returns>
        /// <history>
        ///     [vnguyen]   04/17/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        private static IEnumerable <SearchDocument> GetModuleMetaData(int portalId, DateTime startDate)
        {
            var searchDocs = new List <SearchDocument>();
            var indexer    = new ModuleIndexer();
            var indexSince = FixedIndexingStartDate(portalId, startDate);

            searchDocs.AddRange(indexer.GetModuleMetaData(portalId, indexSince));

            return(searchDocs);
        }
コード例 #6
0
ファイル: SearchEngine.cs プロジェクト: rjallepalli/PIX_CMS
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Indexes content within the given time farame
        /// </summary>
        /// <param name="startDate"></param>
        /// <history>
        ///     [vnguyen]   04/17/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        internal void IndexContent(DateTime startDate)
        {
            var tabIndexer = new TabIndexer();
            var moduleIndexer = new ModuleIndexer(true);
            var userIndexer = new UserIndexer();
            IndexedSearchDocumentCount = 0;
            Results = new Dictionary<string, int>();

            //Index TAB META-DATA
            var searchDocs = GetSearchDocuments(tabIndexer, startDate);
            var searchDocuments = searchDocs as IList<SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();
            Results.Add("Tabs", searchDocuments.Count());

            //Index MODULE META-DATA from modules that inherit from ModuleSearchBase
			searchDocs = GetModuleMetaData(moduleIndexer, startDate);
            searchDocuments = searchDocs as IList<SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();
            Results.Add("Modules (Metadata)", searchDocuments.Count());

            //Index MODULE CONTENT from modules that inherit from ModuleSearchBase
            searchDocs = GetSearchDocuments(moduleIndexer, startDate);
            searchDocuments = searchDocs as IList<SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();
            
            #pragma warning disable 0618
            //Index all Defunct ISearchable module content
            var searchItems = GetContent(moduleIndexer);
            SearchDataStoreProvider.Instance().StoreSearchItems(searchItems);
            #pragma warning restore 0618
            IndexedSearchDocumentCount += searchItems.Count;

            //Both ModuleSearchBase and ISearchable module content count
            Results.Add("Modules (Content)", searchDocuments.Count() + searchItems.Count);

            //Index User data
            if (HostController.Instance.GetBoolean("DisableUserCrawling", false)) return;
            searchDocs = GetSearchDocuments(userIndexer, startDate);
            searchDocuments = searchDocs as IList<SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            var userIndexed =
                searchDocuments.Select(
                    d => d.UniqueKey.Substring(0, d.UniqueKey.IndexOf("_", StringComparison.Ordinal)))
                    .Distinct()
                    .Count();
            IndexedSearchDocumentCount += userIndexed;
            Results.Add("Users", userIndexed);
        }
コード例 #7
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets all the Searchable Module MetaData SearchDocuments within the timeframe for all portals
        /// </summary>
        /// <param name="startDate"></param>
        /// <returns></returns>
        /// <history>
        ///     [vnguyen]   04/17/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        private IEnumerable <SearchDocument> GetModuleMetaData(DateTime startDate)
        {
            var      searchDocs = new List <SearchDocument>();
            var      portals    = PortalController.Instance.GetPortals();
            var      indexer    = new ModuleIndexer();
            DateTime indexSince;

            foreach (var portal in portals.Cast <PortalInfo>())
            {
                indexSince = FixedIndexingStartDate(portal.PortalID, startDate);
                searchDocs.AddRange(indexer.GetModuleMetaData(portal.PortalID, indexSince));
            }

            // Include Host Level Items
            indexSince = FixedIndexingStartDate(-1, startDate);
            searchDocs.AddRange(indexer.GetSearchDocuments(-1, indexSince));

            return(searchDocs);
        }
コード例 #8
0
ファイル: SearchEngine.cs プロジェクト: ws-phil/Dnn.Platform
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Indexes content within the given time farame.
        /// </summary>
        /// -----------------------------------------------------------------------------
        internal void IndexContent()
        {
            // Index TAB META-DATA
            var tabIndexer                 = new TabIndexer();
            var searchDocsCount            = this.GetAndStoreSearchDocuments(tabIndexer);
            var indexedSearchDocumentCount = searchDocsCount;

            this.AddIdexingResults("Tabs Indexed", searchDocsCount);

            // Index MODULE META-DATA from modules that inherit from ModuleSearchBase
            var moduleIndexer = new ModuleIndexer(true);

            searchDocsCount             = this.GetAndStoreModuleMetaData(moduleIndexer);
            indexedSearchDocumentCount += searchDocsCount;
            this.AddIdexingResults("Modules (Metadata) Indexed", searchDocsCount);

            // Index MODULE CONTENT from modules that inherit from ModuleSearchBase
            searchDocsCount             = this.GetAndStoreSearchDocuments(moduleIndexer);
            indexedSearchDocumentCount += searchDocsCount;

            // Index all Defunct ISearchable module content
#pragma warning disable 0618
            var searchItems = this.GetContent(moduleIndexer);
            SearchDataStoreProvider.Instance().StoreSearchItems(searchItems);
#pragma warning restore 0618
            indexedSearchDocumentCount += searchItems.Count;

            // Both ModuleSearchBase and ISearchable module content count
            this.AddIdexingResults("Modules (Content) Indexed", searchDocsCount + searchItems.Count);

            if (!HostController.Instance.GetBoolean("DisableUserCrawling", false))
            {
                // Index User data
                var userIndexer = new UserIndexer();
                var userIndexed = this.GetAndStoreSearchDocuments(userIndexer);
                indexedSearchDocumentCount += userIndexed;
                this.AddIdexingResults("Users", userIndexed);
            }

            this.SchedulerItem.AddLogNote("<br/><b>Total Items Indexed: " + indexedSearchDocumentCount + "</b>");
        }
コード例 #9
0
ファイル: SearchEngine.cs プロジェクト: ryanmalone/BGDNNWEB
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Indexes content within the given time farame
        /// </summary>
        /// <param name="startDate"></param>
        /// <history>
        ///     [vnguyen]   04/17/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        internal void IndexContent(DateTime startDate)
        {
            var tabIndexer    = new TabIndexer();
            var moduleIndexer = new ModuleIndexer();

            IndexedSearchDocumentCount = 0;
            Results = new Dictionary <string, int>();

            //Index TAB META-DATA
            var searchDocs      = GetSearchDocuments(tabIndexer, startDate);
            var searchDocuments = searchDocs as IList <SearchDocument> ?? searchDocs.ToList();

            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();
            Results.Add("Tabs", searchDocuments.Count());

            //Index MODULE META-DATA from modules that inherit from SearchModuleBase
            searchDocs      = GetModuleMetaData(startDate);
            searchDocuments = searchDocs as IList <SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();
            Results.Add("Modules (Metadata)", searchDocuments.Count());

            //Index MODULE CONTENT from modules that inherit from SearchModuleBase
            searchDocs      = GetSearchDocuments(moduleIndexer, startDate);
            searchDocuments = searchDocs as IList <SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();

            #pragma warning disable 0618
            //Index all Defunct ISearchable module content
            var searchItems = GetContent(moduleIndexer);
            SearchDataStoreProvider.Instance().StoreSearchItems(searchItems);
            #pragma warning restore 0618
            IndexedSearchDocumentCount += searchItems.Count;

            //Both SearchModuleBase and ISearchable module content count
            Results.Add("Modules (Content)", searchDocuments.Count() + searchItems.Count);
        }
コード例 #10
0
ファイル: SearchEngine.cs プロジェクト: rrsc/Dnn.Platform
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Indexes content within the given time farame
        /// </summary>
        /// <param name="startDate"></param>
        /// <history>
        ///     [vnguyen]   04/17/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        internal void IndexContent(DateTime startDate)
        {
            var tabIndexer = new TabIndexer();
            var moduleIndexer = new ModuleIndexer();
            IndexedSearchDocumentCount = 0;
            Results = new Dictionary<string, int>();

            //Index TAB META-DATA
            var searchDocs = GetSearchDocuments(tabIndexer, startDate);
            var searchDocuments = searchDocs as IList<SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();
            Results.Add("Tabs", searchDocuments.Count());

            //Index MODULE META-DATA from modules that inherit from SearchModuleBase
            searchDocs = GetModuleMetaData(startDate);
            searchDocuments = searchDocs as IList<SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();
            Results.Add("Modules (Metadata)", searchDocuments.Count());

            //Index MODULE CONTENT from modules that inherit from SearchModuleBase
            searchDocs = GetSearchDocuments(moduleIndexer, startDate);
            searchDocuments = searchDocs as IList<SearchDocument> ?? searchDocs.ToList();
            StoreSearchDocuments(searchDocuments);
            IndexedSearchDocumentCount += searchDocuments.Count();
            
            #pragma warning disable 0618
            //Index all Defunct ISearchable module content
            var searchItems = GetContent(moduleIndexer);
            SearchDataStoreProvider.Instance().StoreSearchItems(searchItems);
            #pragma warning restore 0618
            IndexedSearchDocumentCount += searchItems.Count;

            //Both SearchModuleBase and ISearchable module content count
            Results.Add("Modules (Content)", searchDocuments.Count() + searchItems.Count);
        }
コード例 #11
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// StoreSearchItems adds the Search Item to the Data Store
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name="searchItems">A Collection of SearchItems</param>
 /// <history>
 ///		[cnurse]	11/15/2004	documented
 ///     [vnguyen]   09/07/2010  Modified: Added a date comparison for LastModifiedDate on the Tab
 ///     [vnguyen]   16/04/2013  Modified: Now uses Lucene indexing
 ///     [galatrash] 23/05/2013  Modified: moved indexing methods into the internal namespace.
 /// </history>
 /// -----------------------------------------------------------------------------
 public override void StoreSearchItems(SearchItemInfoCollection searchItems)
 {
     var moduleController = new ModuleController();
     var indexer = new ModuleIndexer();
     
     var modulesDic = new Dictionary<int, string>();
     foreach (SearchItemInfo item in searchItems)
     {                
         if (!modulesDic.ContainsKey(item.ModuleId))
         {
             var module = moduleController.GetModule(item.ModuleId);
             modulesDic.Add(item.ModuleId, module.CultureCode);
             
             //Remove all indexed items for this module
             InternalSearchController.Instance.DeleteSearchDocumentsByModule(module.PortalID, module.ModuleID, module.ModuleDefID);
         }
     }
   
     //Process the SearchItems by Module to reduce Database hits
     foreach (var kvp in modulesDic)
     {
         //Get the Module's SearchItems
         var moduleSearchItems = searchItems.ModuleItems(kvp.Key);
         
         //Convert SearchItemInfo objects to SearchDocument objects
         var searchDocuments = (from SearchItemInfo item in moduleSearchItems select indexer.ConvertSearchItemInfoToSearchDocument(item)).ToList();
         
         //Index
         InternalSearchController.Instance.AddSearchDocuments(searchDocuments);                
     }
 } 
コード例 #12
0
ファイル: SearchEngine.cs プロジェクト: rrsc/Dnn.Platform
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets all the Searchable Module MetaData SearchDocuments within the timeframe for the given portal
        /// </summary>
        /// <param name="portalId"></param>
        /// <param name="startDate"></param>
        /// <returns></returns>
        /// <history>
        ///     [vnguyen]   04/17/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        private static IEnumerable<SearchDocument> GetModuleMetaData(int portalId, DateTime startDate)
        {
            var searchDocs = new List<SearchDocument>();
            var indexer = new ModuleIndexer();
            var indexSince = FixedIndexingStartDate(portalId, startDate);

            searchDocs.AddRange(indexer.GetModuleMetaData(portalId, indexSince));

            return searchDocs;
        }
コード例 #13
0
ファイル: SearchEngine.cs プロジェクト: rrsc/Dnn.Platform
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets all the Searchable Module MetaData SearchDocuments within the timeframe for all portals
        /// </summary>
        /// <param name="startDate"></param>
        /// <returns></returns>
        /// <history>
        ///     [vnguyen]   04/17/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        private IEnumerable<SearchDocument> GetModuleMetaData(DateTime startDate)
        {
            var searchDocs = new List<SearchDocument>();
            var portalController = new PortalController();
            var portals = portalController.GetPortals();
            var indexer = new ModuleIndexer();
            DateTime indexSince;

            foreach (var portal in portals.Cast<PortalInfo>())
            {
                indexSince = FixedIndexingStartDate(portal.PortalID, startDate);
                searchDocs.AddRange(indexer.GetModuleMetaData(portal.PortalID, indexSince));
            }

            // Include Host Level Items
            indexSince = FixedIndexingStartDate(-1, startDate);
            searchDocs.AddRange(indexer.GetSearchDocuments(-1, indexSince));

            return searchDocs;
        }