So you having created your new custom module, what about having its content indexed by the site search?
This process may be divided into 3 sections
1. Module's main presentation File
In your main presentation file ensure that the stub for the site search is included. Shortly after the class definition for our module we require Implements Entities.Modules.ISearchable, our example below whow this, together with those for the inclusion of the additional mouse over menu items and the import and export of data..
Public MustInherit Class Articles_Show
Inherits Entities.Modules.PortalModuleBase
Implements Entities.Modules.IActionable
Implements Entities.Modules.IPortable
Implements Entities.Modules.ISearchable
Elsewhere within this file we have the sub-routine definition.
Public Function GetSearchItems(ByVal ModInfo As Entities.Modules.ModuleInfo) As Services.Search.SearchItemInfoCollection Implements Entities.Modules.ISearchable.GetSearchItems
' included as a stub only so that the core knows this module Implements Entities.Modules.ISearchable
End Function
2. SQL Controller file
As with our main presentation file we need to provide a reference to our additinal sub-routing
Public Class ArticlesController
Implements Entities.Modules.ISearchable
and a definition for our sub-routine
Public Function GetSearchItems(ByVal ModInfo As Entities.Modules.ModuleInfo) As Services.Search.SearchItemInfoCollection Implements Entities.Modules.ISearchable.GetSearchItems
Dim SearchItemCollection As New SearchItemInfoCollection
Dim arrArticles As ArrayList = janetArticles_GetArticleList(ModInfo.ModuleID, ModInfo.PortalID, 1, "Listing", 6, "", "%%", 0)
Dim objArticle As Object
For Each objArticle In arrArticles
Dim SearchItem As SearchItemInfo
With CType(objArticle, ArticlesInfo)
Dim UserId As Integer = Null.NullInteger
Dim strContent As String = System.Web.HttpUtility.HtmlDecode(.Title & " " & .Description)
Dim strDescription As String = HtmlUtils.Shorten(HtmlUtils.Clean(System.Web.HttpUtility.HtmlDecode(.Description), False), 100, "...")
SearchItem = New SearchItemInfo(ModInfo.ModuleTitle & " - " & .Title, strDescription, UserId, .StartDate, ModInfo.ModuleID, .ID.ToString, strContent, "ItemId=" & .ID.ToString)
SearchItemCollection.Add(SearchItem)
End With
Next
Return SearchItemCollection
End Function
3. DesktopModules Table
In the table desktopmodules ensure that the field BusinessControllerClass has an entry. In the dnn file associated with your custom module this will be a line like
janet.Articles.ArticlesController, janet.Articles
and the line in the table for the discussions module is
DotNetNuke.Modules.Discussions.DiscussionController, DotNetNuke.Modules.Discussions
for my recent module this was
janet.Articles.ArticlesController, janet.Articles
NAT June 2005
|
This article viewed: 1299 times |
Back |
Copyright © 2004-2007 Janet Systems Ltd.