/// ----------------------------------------------------------------------------- /// <summary> /// GetSearchItems implements the ISearchable Interface /// </summary> /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param> /// ----------------------------------------------------------------------------- public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo) { var items = new SearchItemInfoCollection(); // Add the devices to the search index. foreach (var item in Factory.ActiveProvider.Devices) { string guid = String.Format("DeviceID={0}", item.DeviceId); var device = new Device(item); items.Add(new SearchItemInfo( device.HardwareCaption, String.Format("{0} running {1} with browser {2}", device.HardwareCaption, device.SoftwareCaption, device.BrowserCaption), ModInfo.CreatedByUserID, Factory.ActiveProvider.PublishedDate, ModInfo.ModuleID, device.DeviceID, device.Content, guid)); } // Add the properties to the search. foreach (var property in Factory.ActiveProvider.Properties) { items.Add(new SearchItemInfo( property.Name, property.Description, ModInfo.CreatedByUserID, Factory.ActiveProvider.PublishedDate, ModInfo.ModuleID, property.Name, property.Description)); foreach (var value in property.Values) { string name = String.Format("{0} - {1}", property.Name, value.Name); items.Add(new SearchItemInfo( name, value.Description, ModInfo.CreatedByUserID, Factory.ActiveProvider.PublishedDate, ModInfo.ModuleID, name, value.Description)); } } return items; }
/// <summary> /// Allow products to be searched via the built-in DNN Search /// </summary> /// <param name="moduleInfo"></param> /// <returns></returns> public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo moduleInfo) { SearchItemInfoCollection searchItemCollection = new SearchItemInfoCollection(); InitializeEntitySpaces(); int portalId = moduleInfo.PortalID; int moduleId = moduleInfo.ModuleID; // We need to always use the same ModuleID because DNN calls this method for each instance of our module that exists. // If we did NOT do this, there would be duplicate Products in the search results List <TabModuleMatch> moduleTabs = DnnHelper.GetTabsWithModuleByModuleDefinitionName(portalId, ModuleDefs.MainDispatch.DefinitionName); if (moduleTabs.Count > 0) { moduleId = moduleTabs[0].ModuleId; } DataModel.Store store = DataModel.Store.GetStoreByPortalId(portalId); if (store != null) { List <Product> allProductsInStore = ProductCollection.GetAll(store.Id.Value, true); foreach (Product p in allProductsInStore) { string description = ""; List <ProductDescriptor> descriptors = p.GetProductDescriptors(); if (descriptors.Count > 0) { description = descriptors[0].TextHtmlDecoded; } //string searchKey = p.Id.Value.ToString(); string searchKey = "DNNspot-Store-Product-" + p.Id.Value.ToString(); string searchContent = p.Name + " " + description; SearchItemInfo searchItem = new SearchItemInfo( p.Name, description.StripHtmlTags().ChopAtWithSuffix(200, "..."), Null.NullInteger, p.ModifiedOn.Value, moduleId, searchKey, searchContent, "product=" + p.Id.Value.ToString() ); searchItemCollection.Add(searchItem); } } return(searchItemCollection); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetSearchItems implements the ISearchable Interface /// </summary> /// <remarks> /// </remarks> /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo) { SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection(); List <DnnTestInfo> colDnnTests = GetDnnTests(ModInfo.ModuleID); foreach (DnnTestInfo objDnnTest in colDnnTests) { SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objDnnTest.Content, objDnnTest.CreatedByUser, objDnnTest.CreatedDate, ModInfo.ModuleID, objDnnTest.ItemId.ToString(), objDnnTest.Content, "ItemId=" + objDnnTest.ItemId.ToString()); SearchItemCollection.Add(SearchItem); } return(SearchItemCollection); }
/// <summary> /// Implements the search interface required to allow DNN to index/search the content of your /// module /// </summary> /// <param name="modInfo"></param> /// <returns></returns> public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo) { SearchItemInfoCollection searchItems = new SearchItemInfoCollection(); List <DetailTinTucInfo> infos = GetDetailTinTucs(modInfo.ModuleID); foreach (DetailTinTucInfo info in infos) { SearchItemInfo searchInfo = new SearchItemInfo(modInfo.ModuleTitle, info.Content, info.CreatedByUser, info.CreatedDate, modInfo.ModuleID, info.ItemId.ToString(), info.Content, "Item=" + info.ItemId.ToString()); searchItems.Add(searchInfo); } return(searchItems); }
public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo) { SearchItemInfoCollection itmSearchColl = new SearchItemInfoCollection(); MediaInfo itm = GetMedia(ModInfo.ModuleID); if (itm != null) { string content = string.Concat(itm.Alt, " :: ", StripTags(itm.MediaMessage)); SearchItemInfo itmSearch = new SearchItemInfo(ModInfo.ModuleTitle, content, itm.LastUpdatedBy, itm.LastUpdatedDate, ModInfo.ModuleID, itm.ModuleID.ToString(), content); itmSearchColl.Add(itmSearch); } return(itmSearchColl); }
public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo) { SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection(); List <ProvinceInfo> colProvinces = GetProvinces(); foreach (ProvinceInfo objProvince in colProvinces) { if (objProvince != null) { SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objProvince.Name, objProvince.CreatedByUser, objProvince.CreatedDate, ModInfo.ModuleID, objProvince.Id.ToString(), objProvince.Name, "ItemId=" + objProvince.Id.ToString()); SearchItemCollection.Add(SearchItem); } } return(SearchItemCollection); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetSearchItems implements the ISearchable Interface /// </summary> /// <remarks> /// </remarks> /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo) { SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection(); List <SF_EventsMapInfo> colSF_EventsMaps = GetSF_EventsMaps(ModInfo.ModuleID); foreach (SF_EventsMapInfo objSF_EventsMap in colSF_EventsMaps) { if (objSF_EventsMap != null) { SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objSF_EventsMap.Content, objSF_EventsMap.CreatedByUser, objSF_EventsMap.CreatedDate, ModInfo.ModuleID, objSF_EventsMap.ItemId.ToString(), objSF_EventsMap.Content, "ItemId=" + objSF_EventsMap.ItemId.ToString()); SearchItemCollection.Add(SearchItem); } } return(SearchItemCollection); }
public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo) { SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection(); List <NoticesInfo> colNotices = GetNoticess(); foreach (NoticesInfo objNotices in colNotices) { if (objNotices != null) { SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objNotices.title, objNotices.editor, objNotices.notedate, ModInfo.ModuleID, objNotices.id.ToString(), objNotices.title, "ItemId=" + objNotices.id.ToString()); SearchItemCollection.Add(SearchItem); } } return(SearchItemCollection); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetSearchItems implements the ISearchable Interface /// </summary> /// <remarks> /// </remarks> /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo) { SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection(); List <ATI_PeopleInfo> colATI_Peoples = GetATI_Peoples(ModInfo.ModuleID); foreach (ATI_PeopleInfo objATI_People in colATI_Peoples) { if (objATI_People != null) { SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objATI_People.Content, objATI_People.CreatedByUser, objATI_People.CreatedDate, ModInfo.ModuleID, objATI_People.ItemId.ToString(), objATI_People.Content, "ItemId=" + objATI_People.ItemId.ToString()); SearchItemCollection.Add(SearchItem); } } return(SearchItemCollection); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetSearchItems implements the ISearchable Interface /// </summary> /// <remarks> /// </remarks> /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo) { ProductController pc = new ProductController(); SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection(); List <ProductInfo> colDnnCarts = pc.GetProducts(ModInfo.ModuleID); foreach (ProductInfo objProduct in colDnnCarts) { if (objProduct != null) { SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objProduct.ShortDescription, objProduct.CreatedByUser, objProduct.CreatedDate, ModInfo.ModuleID, objProduct.ProductId.ToString(), objProduct.LongDescription, "ProductId=" + objProduct.ProductId.ToString()); SearchItemCollection.Add(SearchItem); } } return(SearchItemCollection); }
/// <summary> /// Implements the search interface required to allow DNN to index/search the content of your /// module /// </summary> /// <param name="modInfo"></param> /// <returns></returns> public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo) { SearchItemInfoCollection searchItems = new SearchItemInfoCollection(); using (SelectedHotelsEntities db = new SelectedHotelsEntities()) { IList <Product> products = (from p in db.Products where !p.IsDeleted select p).ToList(); foreach (var product in products) { SearchItemInfo searchInfo = new SearchItemInfo(product.Name, product.Description, product.CreatedByUser, product.CreatedDate, modInfo.ModuleID, product.Id.ToString(), product.Description, "Id=" + product.Id); searchItems.Add(searchInfo); } } return(searchItems); }
/// <summary> /// Implements the search interface required to allow DNN to index/search the content of your /// module /// </summary> /// <param name="modInfo"></param> /// <returns></returns> public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo) { SearchItemInfoCollection searchItems = new SearchItemInfoCollection(); using (SelectedHotelsEntities db = new SelectedHotelsEntities()) { IList <Hotel> hotels = (from p in db.Products where !p.IsDeleted select p).OfType <Hotel>().ToList(); foreach (var hotel in hotels) { SearchItemInfo searchInfo = new SearchItemInfo(hotel.Name, hotel.Description, hotel.CreatedByUser, hotel.CreatedDate, modInfo.ModuleID, hotel.Id.ToString(), hotel.Description, "Id=" + hotel.Id); searchItems.Add(searchInfo); } } return(searchItems); }
public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo) { var SearchItemCollection = new SearchItemInfoCollection(); SearchItemInfo SearchItem = null; string summary = null; string title = null; var cdc = new ContentDejourController(); var objContents = cdc.GetContents(ModInfo.ModuleID, MonthArray.Null, DayArray.Null, DayofWeekArray.Null, DateInteger.Null, Null.NullInteger, Null.NullInteger, Null.NullInteger, "", false); foreach (ContentDejourInfo objContent in objContents) { title = HttpUtility.HtmlDecode(objContent.Title); summary = Utilities.GetSummary(objContent.DesktopSummary, objContent.DesktopHTML); SearchItem = new SearchItemInfo(ModInfo.ModuleTitle + " - " + title, summary, objContent.CreatedByUserID, objContent.CreatedOnDate, ModInfo.ModuleID, objContent.KeyID.ToString(), HttpUtility.HtmlDecode(objContent.DesktopHTML), "KeyID=" + objContent.KeyID.ToString()); SearchItemCollection.Add(SearchItem); } return(SearchItemCollection); }
/// ----------------------------------------------------------------------------- /// <summary> /// Indexes content within the given time farame /// </summary> /// ----------------------------------------------------------------------------- internal void IndexContent() { //Index TAB META-DATA TabIndexer tabIndexer = new TabIndexer(); int searchDocsCount = GetAndStoreSearchDocuments(tabIndexer); int indexedSearchDocumentCount = searchDocsCount; AddIdexingResults("Tabs Indexed", searchDocsCount); //Index MODULE META-DATA from modules that inherit from ModuleSearchBase ModuleIndexer 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; //Index all Defunct ISearchable module content #pragma warning disable 0618 SearchItemInfoCollection searchItems = GetContent(moduleIndexer); SearchDataStoreProvider.Instance().StoreSearchItems(searchItems); #pragma warning restore 0618 indexedSearchDocumentCount += searchItems.Count; //Both ModuleSearchBase and ISearchable module content count AddIdexingResults("Modules (Content) Indexed", searchDocsCount + searchItems.Count); if (!HostController.Instance.GetBoolean("DisableUserCrawling", false)) { //Index User data UserIndexer userIndexer = new UserIndexer(); int userIndexed = GetAndStoreSearchDocuments(userIndexer); indexedSearchDocumentCount += userIndexed; AddIdexingResults("Users", userIndexed); } SchedulerItem.AddLogNote("<br/><b>Total Items Indexed: " + indexedSearchDocumentCount + "</b>"); }
public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo) { SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection(); LocaleCollection lCollection = Localization.GetEnabledLocales(); foreach (Locale localeInfo in lCollection) { effority.Ealo.StringInfo objText; effority.Ealo.StringInfo objSummary; objText = effority.Ealo.Controller.GetStringByQualifierAndStringName(Consts.DesktopHTMLQualifier, ModInfo.ModuleID.ToString(), localeInfo.Code, true); objSummary = effority.Ealo.Controller.GetStringByQualifierAndStringName(Consts.DesktopSummaryQualifier, ModInfo.ModuleID.ToString(), localeInfo.Code, true); if (!objText.StringTextIsNull) { string strDesktopHtml = HttpUtility.HtmlDecode(objText.StringText); string strDescription = HtmlUtils.Shorten(HtmlUtils.Clean(strDesktopHtml, false), MAX_DESCRIPTION_LENGTH, "..."); SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, localeInfo.Text + " - " + strDescription, -1, DateTime.Now, ModInfo.ModuleID, "", objSummary.StringText + " " + strDesktopHtml, "", Null.NullInteger); SearchItemCollection.Add(SearchItem); } } return(SearchItemCollection); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetSearchItems implements the ISearchable Interface /// </summary> /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param> /// ----------------------------------------------------------------------------- public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo) { SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection(); List <Classes> colSchoolGradess = new List <Classes>(); foreach (Classes e in new ClassController().GetClasses()) { colSchoolGradess.Add(e); } foreach (Classes objSchoolGrades in colSchoolGradess) { SearchItemInfo SearchItem2 = new SearchItemInfo(ModInfo.ModuleTitle, objSchoolGrades.SubjectId.ToString(), objSchoolGrades.StudentId, System.DateTime.Now, ModInfo.ModuleID, objSchoolGrades.StudentId.ToString(), "SubId=" + objSchoolGrades.SubjectId.ToString()); SearchItemCollection.Add(SearchItem2); } return(SearchItemCollection); // throw new System.NotImplementedException("The method or operation is not implemented."); }
/* * /// <summary> * /// Delete a given item from the database by ID * /// </summary> * /// <param name='itemId'></param> * public void DeleteObserverOfScience (int itemId) * { * using (var ctx = DataContext.Instance()) * { * var repo = ctx.GetRepository<ObserverOfScienceInfo> (); * repo.Delete ("WHERE ObserverOfScienceID = @0", itemId); * } * } */ #endregion #region ISearchable members /// <summary> /// Implements the search interface required to allow DNN to index/search the content of your /// module /// </summary> /// <param name="modInfo"></param> /// <returns></returns> public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo) { var searchItems = new SearchItemInfoCollection(); var infos = GetList <ObserverOfScienceInfo> (modInfo.ModuleID); foreach (ObserverOfScienceInfo info in infos) { searchItems.Add( new SearchItemInfo( modInfo.ModuleTitle, "", info.CreatedByUser, info.CreatedOnDate, modInfo.ModuleID, info.ObserverOfScienceID.ToString(), // info.Content, "Item=" + info.ObserverOfScienceID.ToString()) ); } return(searchItems); }
///<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); }
/// <summary> /// Gets the search items. /// </summary> /// <param name="modInfo">The module information.</param> /// <returns>Topics that meet the search criteria.</returns> public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo) { using (UnitOfWork uOw = new UnitOfWork()) { TopicBO topicBo = new TopicBO(uOw); SearchItemInfoCollection searchItemCollection = new SearchItemInfoCollection(); var topics = topicBo.GetAllByModuleID(modInfo.ModuleID); UserController uc = new UserController(); foreach (var topic in topics) { SearchItemInfo searchItem = new SearchItemInfo(); string strContent = null; string strDescription = null; string strTitle = null; if (!string.IsNullOrWhiteSpace(topic.Title)) { strTitle = topic.Title; } else { strTitle = topic.Name; } if (topic.Cache != null) { strContent = topic.Cache; strContent += " " + topic.Keywords; strContent += " " + topic.Description; strDescription = HtmlUtils.Shorten(HtmlUtils.Clean(HttpUtility.HtmlDecode(topic.Cache), false), 100, Localization.GetString("Dots", this.mSharedResourceFile)); } else { strContent = topic.Content; strContent += " " + topic.Keywords; strContent += " " + topic.Description; strDescription = HtmlUtils.Shorten(HtmlUtils.Clean(HttpUtility.HtmlDecode(topic.Content), false), 100, Localization.GetString("Dots", this.mSharedResourceFile)); } int userID = 0; userID = Null.NullInteger; if (topic.UpdatedByUserID != -9999) { userID = topic.UpdatedByUserID; } searchItem = new SearchItemInfo(strTitle, strDescription, userID, topic.UpdateDate, modInfo.ModuleID, topic.Name, strContent, "topic=" + WikiMarkup.EncodeTitle(topic.Name)); //// New SearchItemInfo(ModInfo.ModuleTitle & "-" & strTitle, strDescription, //// userID, topic.UpdateDate, ModInfo.ModuleID, topic.Name, strContent, _ //// "topic=" & WikiMarkup.EncodeTitle(topic.Name)) searchItemCollection.Add(searchItem); } return(searchItemCollection); } }
/// ----------------------------------------------------------------------------- /// <summary> /// GetSearchItems implements the ISearchable Interface /// </summary> /// <remarks> /// </remarks> /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo) { SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection(); return(SearchItemCollection); }
/// ----------------------------------------------------------------------------- /// <summary> /// Implements the search interface for DotNetNuke /// </summary> /// ----------------------------------------------------------------------------- public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo) { var searchItemCollection = new SearchItemInfoCollection(); var udtController = new UserDefinedTableController(modInfo); try { var dsUserDefinedRows = udtController.GetDataSet(withPreRenderedValues: false); //Get names of ChangedBy and ChangedAt columns var colnameChangedBy = udtController.ColumnNameByDataType(dsUserDefinedRows, DataTypeNames.UDT_DataType_ChangedBy); var colnameChangedAt = udtController.ColumnNameByDataType(dsUserDefinedRows, DataTypeNames.UDT_DataType_ChangedAt); var moduleController = new ModuleController(); var settings = moduleController.GetModuleSettings(modInfo.ModuleID); var includeInSearch = !(settings[SettingName.ExcludeFromSearch].AsBoolean()); if (includeInSearch) { foreach (DataRow row in dsUserDefinedRows.Tables[DataSetTableName.Data].Rows) { var changedDate = DateTime.Today; var changedByUserId = 0; if (colnameChangedAt != string.Empty && !Information.IsDBNull(row[colnameChangedAt])) { changedDate = Convert.ToDateTime(row[colnameChangedAt]); } if (colnameChangedBy != string.Empty && !Information.IsDBNull(row[colnameChangedBy])) { changedByUserId = ModuleSecurity.UserId(row[colnameChangedBy].ToString(), modInfo.PortalID); } var desc = string.Empty; foreach (DataRow col in dsUserDefinedRows.Tables[DataSetTableName.Fields].Rows) { var fieldType = col[FieldsTableColumn.Type].ToString(); var fieldTitle = col[FieldsTableColumn.Title].ToString(); var visible = Convert.ToBoolean(col[FieldsTableColumn.Visible]); if (visible && (fieldType.StartsWith("Text") || fieldType == DataTypeNames.UDT_DataType_String)) { desc += string.Format("{0} • ", Convert.ToString(row[fieldTitle])); } } if (desc.EndsWith("<br/>")) { desc = desc.Substring(0, Convert.ToInt32(desc.Length - 5)); } var searchItem = new SearchItemInfo(modInfo.ModuleTitle, desc, changedByUserId, changedDate, modInfo.ModuleID, row[DataTableColumn.RowId].ToString(), desc); searchItemCollection.Add(searchItem); } } } catch (Exception ex) { Exceptions.LogException(ex); } return(searchItemCollection); }
private static void SearchArticleIndex(DataTable dt, SearchItemInfoCollection items, ModuleInfo modInfo) { for (int i = 0; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; var searchedContent = new StringBuilder(8192); //article name string name = HtmlUtils.Clean(row["Name"].ToString().Trim(), false); if (Utility.HasValue(name)) { searchedContent.AppendFormat("{0}{1}", name, " "); } else { //do we bother with the rest? continue; } //article text string articleText = row["ArticleText"].ToString().Trim(); if (Utility.HasValue(articleText)) { searchedContent.AppendFormat("{0}{1}", articleText, " "); } //article description string description = row["Description"].ToString().Trim(); if (Utility.HasValue(description)) { searchedContent.AppendFormat("{0}{1}", description, " "); } //article metakeyword string keyword = row["MetaKeywords"].ToString().Trim(); if (Utility.HasValue(keyword)) { searchedContent.AppendFormat("{0}{1}", keyword, " "); } //article metadescription string metaDescription = row["MetaDescription"].ToString().Trim(); if (Utility.HasValue(metaDescription)) { searchedContent.AppendFormat("{0}{1}", metaDescription, " "); } //article metatitle string metaTitle = row["MetaTitle"].ToString().Trim(); if (Utility.HasValue(metaTitle)) { searchedContent.AppendFormat("{0}{1}", metaTitle, " "); } string itemId = row["ItemId"].ToString(); var item = new SearchItemInfo { Title = name, Description = HtmlUtils.Clean(description, false), Author = Convert.ToInt32(row["AuthorUserId"], CultureInfo.InvariantCulture), PubDate = Convert.ToDateTime(row["LastUpdated"], CultureInfo.InvariantCulture), ModuleId = modInfo.ModuleID, SearchKey = "Article-" + itemId, Content = HtmlUtils.StripWhiteSpace( HtmlUtils.Clean(searchedContent.ToString(), false), true), GUID = "itemid=" + itemId }; items.Add(item); //Check if the Portal is setup to enable venexus indexing if (ModuleBase.AllowVenexusSearchForPortal(modInfo.PortalID)) { string indexUrl = Utility.GetItemLinkUrl(Convert.ToInt32(itemId, CultureInfo.InvariantCulture), modInfo.PortalID, modInfo.TabID, modInfo.ModuleID); //UpdateVenexusBraindump(IDbTransaction trans, string indexTitle, string indexContent, string indexWashedContent) Data.DataProvider.Instance().UpdateVenexusBraindump(Convert.ToInt32(itemId, CultureInfo.InvariantCulture), name, articleText, HtmlUtils.Clean(articleText, false), modInfo.PortalID, indexUrl); } //} } }