Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

  • 4/7/2015
  • 7608 Views

Comments

7608 Views

ISearchable

Last updated long time ago

Comments

Common

(Enter the content of this article below)

Advanced

 
This interface allows module developers to implement a common collection of items that DotNetNuke can index and provide via the search results module.

Example Code (VB)


'/// -----------------------------------------------------------------------------
'/// <summary>
'/// GetSearchItems implements the ISearchable Interface
'/// </summary>
'/// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
'/// -----------------------------------------------------------------------------
Public Function GetSearchItems(ByVal ModInfo As ModuleInfo) As SearchItemInfoCollection Implements ISearchable.GetSearchItems
Dim searchItemCollection = New SearchItemInfoCollection()

Dim colArticles As List(Of Article) = ArticleController.GetArticles(ModInfo.ModuleID)

For Each objArticle As Article In colArticles
Dim searchItem As New SearchItemInfo
searchItem.Title = objArticle.Title
searchItem.Description = objArticle.Description
searchItem.Author = objArticle.CreatedByUserId
searchItem.PubDate = objArticle.LastModifiedOnDate
searchItem.ModuleId = ModInfo.ModuleID
searchItem.SearchKey = objArticle.ArticleId.ToString()
searchItem.Content = objArticle.Body
searchItem.GUID = "aid=" + objArticle.ArticleId.ToString
searchItemCollection.Add(searchItem)
Next

Return searchItemCollection
End Function



Example Code (C#)


/// -----------------------------------------------------------------------------
/// <summary>
/// GetSearchItems implements the ISearchable Interface
/// </summary>
/// <param name="modInfo">The ModuleInfo for the module to be Indexed</param>
/// -----------------------------------------------------------------------------
public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
{
var searchItemCollection = new SearchItemInfoCollection();

List<Article> colArticles = ArticleController.GetArticles(modInfo.ModuleID);

foreach (Article objArticle in colArticles)
{
var searchItem = new SearchItemInfo(objArticle.Title,
objArticle.Description, objArticle.CreatedByUserID, objArticle.LastModifiedOnDate,
modInfo.ModuleID, objArticle.ArticleId.ToString(), objArticle.Body, "aid=" +
objArticle.ArticleId);
searchItemCollection.Add(searchItem);
}

return searchItemCollection;
}



Example Source Project

The example code from this project can be found on http://dnnsimplearticle.codeplex.com

References

Contents
No sections defined
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out