From 37c0ccdc1c96d3035f9bb317fda926f9ad40a5e2 Mon Sep 17 00:00:00 2001 From: Ilpo Juvander Date: Wed, 17 Oct 2018 21:22:15 +0300 Subject: [PATCH] Fixing search issues for DNN9 --- .../DNN_5/Components/Controllers/ThreadController.vb | 10 +++++----- .../DNN_5/Components/Portals/ForumPortalSettings.vb | 4 +++- branches/DNN_5/Components/Utilities/Links.vb | 8 +++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/branches/DNN_5/Components/Controllers/ThreadController.vb b/branches/DNN_5/Components/Controllers/ThreadController.vb index 6c91f14..f76b86a 100644 --- a/branches/DNN_5/Components/Controllers/ThreadController.vb +++ b/branches/DNN_5/Components/Controllers/ThreadController.vb @@ -349,9 +349,9 @@ Namespace DotNetNuke.Modules.Forum For Each thread In ThreadSearchCollection 'log.Debug("Search found: " + thread.Subject) Dim sitem As Search.Entities.SearchDocument = New Search.Entities.SearchDocument() - sitem.Body = HttpUtility.HtmlDecode(thread.Body) + sitem.Description = HtmlUtils.ConvertToText(HttpUtility.HtmlDecode(thread.Body)) sitem.AuthorUserId = thread.CreatedByUser - sitem.Description = HtmlUtils.Shorten(thread.Body, 100, "...") + sitem.Body = HtmlUtils.Shorten(HtmlUtils.ConvertToText(HttpUtility.HtmlDecode(thread.Body)), 100, "...") sitem.IsActive = True 'sitem.Keywords = Nothing 'log.Debug("UpdateDate: " + thread.UpdatedDate.ToString) @@ -361,7 +361,7 @@ Namespace DotNetNuke.Modules.Forum 'sitem.NumericKeys 'sitem.Permissions sitem.PortalId = moduleInfo.PortalID - 'sitem.QueryString + 'sitem.QueryString = 'sitem.RoleId 'sitem.SearchTypeId sitem.TabId = moduleInfo.TabID @@ -375,11 +375,11 @@ Namespace DotNetNuke.Modules.Forum Next sitem.Tags = ters - 'log.Debug("TabPath: " + tinfo.TabPath) sitem.Title = HttpUtility.HtmlDecode(thread.Subject) sitem.UniqueKey = thread.PostID.ToString - sitem.Url = New Uri(Links.ContainerViewPostLink(moduleInfo.PortalID, moduleInfo.TabID, thread.ForumID, thread.PostID, thread.Subject), UriKind.Relative).ToString() + + sitem.Url = New Uri(Links.ContainerViewQueryLink(moduleInfo.PortalID, moduleInfo.TabID, thread.ForumID, thread.PostID, thread.Subject)).PathAndQuery retval.Add(sitem) Next End If diff --git a/branches/DNN_5/Components/Portals/ForumPortalSettings.vb b/branches/DNN_5/Components/Portals/ForumPortalSettings.vb index ecf578c..18372aa 100644 --- a/branches/DNN_5/Components/Portals/ForumPortalSettings.vb +++ b/branches/DNN_5/Components/Portals/ForumPortalSettings.vb @@ -162,7 +162,9 @@ Namespace DotNetNuke.Modules.Forum HttpContext.Current = New HttpContext(workerRequest) End If 'stash the portalSettings in the Context Items, where the rest of the DNN Code expects it to be - HttpContext.Current.Items.Add("PortalSettings", ps) + If (HttpContext.Current.Items.Contains("PortalSettings") = False) Then + HttpContext.Current.Items.Add("PortalSettings", ps) + End If Return ps End Function diff --git a/branches/DNN_5/Components/Utilities/Links.vb b/branches/DNN_5/Components/Utilities/Links.vb index 9fad1a0..bafc08c 100644 --- a/branches/DNN_5/Components/Utilities/Links.vb +++ b/branches/DNN_5/Components/Utilities/Links.vb @@ -440,10 +440,16 @@ Namespace DotNetNuke.Modules.Forum.Utilities Dim Path As String Dim TabInfo As DotNetNuke.Entities.Tabs.TabInfo = TabController.Instance.GetTab(TabId, PortalId, False) Path = "~/default.aspx?tabid=" & TabId & "&forumid=" & ForumId & "&postid=" & PostId & "&scope=posts" - Return DotNetNuke.Common.Globals.FriendlyUrl(TabInfo, Path, CreateFriendlySlug(PostTitle)) & "#" & PostId End Function + Public Shared Function ContainerViewQueryLink(ByVal PortalId As Integer, ByVal TabId As Integer, ByVal ForumId As Integer, ByVal PostId As Integer, ByVal PostTitle As String) As String + Dim pSettings As PortalSettings = ForumPortalSettings.CreateNewPortalSettings(PortalId) + Dim Path As String + Dim TabInfo As DotNetNuke.Entities.Tabs.TabInfo = TabController.Instance.GetTab(TabId, PortalId, False) + Path = "~/default.aspx?tabid=" & TabId & "&forumid=" & ForumId & "&postid=" & PostId & "&scope=posts" + Return DotNetNuke.Common.Globals.FriendlyUrl(TabInfo, Path, CreateFriendlySlug(PostTitle), pSettings) & "#" & PostId + End Function ''' ''' Navigates user to specific page of results for a thread view.