DotNetNuke Search


DotNetNuke Search (core project)
DNN Search is part of the DNN core that is installed and configured out of the box.

DotNetNuke Search consists of 4 main pieces:
  • Scheduled Task
The scheduled task initiates the process of indexing the modules, at the scheduled time interval. An iteration of all modules that support iSearchable is performed. During this process, text that is extracted from the module is cleaned, parsed, and added to search word and search items tables.
  • Search Admin
The search admin is for setting the maximum word length, minimum word length, option to include common words, and the option to include numbers. 
  • Search Input Module
A module or skin object can be used to provide the form for the search query. In module settings, you can use the default button, or an image. You do not have the option to change this image within the module, nor change the text. Styles can be used to make some look and feel changes, but it is limited. When a search is performed, the user is redirected to the Search Results page.
  • Search Results Module
This module provides the search results. In the settings, you can set the maximum search results, results per page, maximum title length, maximum description length, and the option to show description. Results are limited to the exact word queried.

SEARCH DotNetNuke

The ISearchable interface is used to allow the users of your module to search for content using the search mechanism provided by the DotNetNuke framework
It works more like an index in the back of a book.
The only items in the index are items that the author (in this case the module developer) has decided to put there. The search merely allows DotNetNuke portal users to quickly find items placed in this index.

Implementing Search for the Survey Module
To implement search for the Survey module we performed three steps:
Indicate that the controller class will implement the ISearchable interface
  • Insert the code for the ISearchable interface
  • Update the module configuration

Implement ISearchable in the Controller Class

 

When you look at the module definition for the Survey module, you can see that the controller class defined is DotNetNuke.Modules.Survey.SurveyController
Public Function GetSearchItems(ByVal ModInfo As Entities.Modules.ModuleInfo) _
As Services.Search.SearchItemInfoCollection Implements Entities.Modules.ISearchable.GetSearchItems
' Get the Surveys for this Module instance
Dim colSurveys As List(Of SurveyInfo) = GetSurveys(ModInfo.ModuleID)
Dim SearchItemCollection As New SearchItemInfoCollection
Dim SurveyInfo As SurveyInfo
For Each SurveyInfo In colSurveys
Dim SearchItem As SearchItemInfo
SearchItem = New SearchItemInfo _
(ModInfo.ModuleTitle & " - " & SurveyInfo.Question, _
SurveyInfo.Question, _
SurveyInfo.CreatedByUser, _
SurveyInfo.CreatedDate, ModInfo.ModuleID, _
SurveyInfo.SurveyId, _
SurveyInfo.Question)
SearchItemCollection.Add(SearchItem)
Next
Return
SearchItemCollection
End
Function

To implement the search we performed three steps:
  • Created and filled a SearchItemInfo object
  • Added this object to the SearchItemInfoCollection collection
  • Returned the SearchItemInfoCollection as the output for the method
  • The important thing to remember is that the SearchKey parameter must be a unique value. In this case we passed the contents of the SurveyId field (from the Surveys table) to the SearchKey parameter.
  • The Content is the content that the portal users will be searching on. We passed the contents of the Question field to the Content parameter. As you can see in the table schema below, the Question field has a direct one-to-one relationship with the SurveyID field.


This line adds the SearchItemInfo object to the SearchItemInfoCollection collection:
SearchItemCollection.Add(SearchItem)
This line returns the SearchItemInfoCollection collection as the output of the method:
Return SearchItemCollection

Comments

Popular posts from this blog

SQL Server 2016 TDE ( Transparent Data Encryption)

Setting up Dotnetnuke (DNN) to work with Active Directory

Programming !!!!!!!!!!!