The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

ISearchable

Last post 02-18-2008, 9:29 AM by Scott.Schecter. 5 replies.
Sort Posts: Previous Next
  •  02-18-2008, 4:44 AM 8103

    ISearchable

    Scott,

    Some words of wisdom please!

    I am attempting to implement ISearchable and added a class to read the data and return a SearchItemInfoCollection as per the DNN docs. Even though my module includes ISearchable the Searchable check box on the module settings page is unchecked.

    I then manually updated DesktopModules SupportedFeatures to a value of 2 which turns the checkbox on. Running the Search Re-index does not call my module for any data. If I then update the module settings (click update) the Searchable check box is unchecked. From this I suspect DNN is looking for the function in my module and not finding it. I then added a "controller" class to the settings which is where the function resides that supports the search

    dws.Modules.SimpleEvents.SimpleEventSearch

    but still DNN unchecks the Searchable checkbox. Object browser shows the function in the class. Have I missed something?

     

    My module is in a single dll including the Custom and Generated ES classes. The Search class is shown below.

     

    Any suggestions appreciated.

    Declan 

     

     

    Code:
    Imports DotNetNuke
    Imports DotNetNuke.Services.Search

    Imports EntitySpaces.Interfaces
    Imports BusinessObjects

    Namespace dws.Modules.SimpleEvents
    Public Class SimpleEventSearch

    Inherits dws.Modules.SimpleEvents.SimpleEventBase
    Implements Entities.Modules.ISearchable

    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

    InitES()

    Try

    Dim
    collEvents As New DwsSimpleEventsCollection
    Dim SearchItemCollection As New SearchItemInfoCollection
    Dim objEvent As DwsSimpleEvents

    For Each objEvent In collEvents
    Dim SearchItem As SearchItemInfo
    SearchItem = New SearchItemInfo( _
    ModInfo.ModuleTitle & " - " & objEvent.EventTitle, _
    objEvent.EventTitle, _
    "", _
    objEvent.EventDate, _
    ModInfo.ModuleID, _
    objEvent.EventID, _ ' Should be url to item
    objEvent.EventTitle)
    SearchItemCollection.Add(SearchItem)
    Next
    collEvents = Nothing
    objEvent = Nothing
    Return
    SearchItemCollection

    Catch ex As Exception
    Return Nothing
    End Try

    End Function
    End Class
    End Namespace
     
  •  02-18-2008, 5:11 AM 8104 in reply to 8103

    Re: ISearchable

    I don't see anything immediately wrong with that code. I don't do much coding in VB so I am unsure about that extra Implements on your function signature. If dnn is not recognizing your module as ISearchable then somehow the interface is not implemented correctly though would be my guess. Here is what I use in C# if it helps

     

    Code:
            /// -----------------------------------------------------------------------------
    /// <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<NukeSyndicateInfo> colNukeSyndicates = GetNukeSyndicates(ModInfo.ModuleID, 1, 5000, string.Empty, false);

    foreach (NukeSyndicateInfo objNukeSyndicate in colNukeSyndicates)
    {
    if(objNukeSyndicate != null)
    {
    SearchItemInfo SearchItem = new SearchItemInfo(
    objNukeSyndicate.ItemTitle, objNukeSyndicate.ItemDescription, objNukeSyndicate.UserId,
    objNukeSyndicate.ItemDate, ModInfo.ModuleID, objNukeSyndicate.ItemId.ToString(),
    objNukeSyndicate.ItemDescription, "ItemId=" + objNukeSyndicate.ItemId.ToString());
    SearchItemCollection.Add(SearchItem);
    }
    }

    return SearchItemCollection;
    }
     
    Regards,

    Scott Schecter
    EntitySpaces | My Site
  •  02-18-2008, 8:24 AM 8108 in reply to 8104

    Re: ISearchable

    Your code is pretty much the same as mine.

    The Event viewer sheds a little light:

    InnerException: Could not load type 'dws.Modules.SimpleEvents'.
    FileName:
    FileLineNumber: 0
    FileColumnNumber: 0
    Method: System.Web.Compilation.BuildManager.GetType
    StackTrace:
    Message: System.Web.HttpException: Could not load type 'dws.Modules.SimpleEvents'. at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) at DotNetNuke.Framework.Reflection.CreateType(String TypeName, String CacheKey, Boolean UseCache, Boolean IgnoreErrors)

    but I can't see why as the dll is in the bin folder:  dws.Modules.SimpleEvents.dll

    AFAIK the first part of the entry in the businesscontrollerclass is the fully qualified name followed by the assembly name. In my case that should be:

    dws.Modules.SimpleEvents.SimpleEventSearch, dws.Modules.SimpleEvents

    Any thoughts on why it can't load it? If not I'll take this to where it should be the DNN forumWink

    Another case of "can't see the obvious"?

  •  02-18-2008, 8:49 AM 8110 in reply to 8108

    Re: ISearchable

    Your going to need to open your assembly with Reflector and check your namespace. My guess is this has to do with the VB notion of root namespace, and most likely your namespace will not be as you expected it when you check it in Reflector.

    Regards,

    Scott Schecter
    EntitySpaces | My Site
  •  02-18-2008, 9:08 AM 8115 in reply to 8110

    Re: ISearchable

    Reflector showed an error on inheriting from my base class. Once I fixed this DNN flagged the module as Searchable.

    Thanks Scott.

     

    Declan 

  •  02-18-2008, 9:29 AM 8117 in reply to 8115

    Re: ISearchable

    You are welcome.

    Regards,

    Scott Schecter
    EntitySpaces | My Site
View as RSS news feed in XML