SearchSkinObject always redirects to the same TabId even in multilanguage portals


I was having an issue with the SearchSkinObject redirecting all search requests to the pt-br tabid, even when using the en-us site, because of this code:

If _searchModule Is Nothing Then
_searchModule = NukeHelper.ModuleController.GetModuleByDefinition(

in the Private ReadOnly Property searchModule() As ModuleInfo (line 61 of SearchSkinObject.ascx.vb)

Because the Search tabid is different in my pt-br and en-us sites, but this piece of code was always returning the pt-br moduleInfo/tab

I changed to

If searchModule Is Nothing Or (searchModule IsNot Nothing AndAlso _searchModule.CultureCode <> PortalSettings.CultureCode) Then

Dim _searchModules = NukeHelper.ModuleController.GetModulesByDefinition(PortalSettings.PortalId, Common.Constants.ModuleNameLuceneSearchResults)

If _searchModules.Count > 1 Then
For Each moduleItem As ModuleInfo In _searchModules
If moduleItem.CultureCode = PortalSettings.CultureCode Then
_searchModule = moduleItem
End If
If _searchModule Is Nothing Then
_searchModule = DirectCast(_searchModules(0 ), ModuleInfo)
End If
ElseIf _searchModules.Count = 1 Then
_searchModule = DirectCast(_searchModules( 0), ModuleInfo)
End If
End If

this worked but I had to create a CustomSearchSkinObject.ascx and CustomSearchSkinObject.ascx.vb in my portal httpdocs final path (httpdocs\DesktopModules\Aricie.LuceneSearch\CustomSearchSkinObject.ascx) because Aricie.LuceneSearch.Module references an older version of DNN where the TabInfo doesn't have a CultureCode property and code won't compile, I also tried to reference a newer DNN version but I got a lot of errors in doing so, so I created the local CustomSearchSkinObject.ascx.vb and it worked !

I was wondering if there was a better way of assuring _searchModule points to the right ModuleInfo depending on language being used

It took me long to discover that the module settings was different in pt-br and en-us versions, with different LuceneSearch.Templates.Portal.0.Module.{ModuleId_Here}.resx resources and that was the key to me discover where my issue was

Hope my findings helps anyone!