Skip to content

Commit

Permalink
add search activity log to insights
Browse files Browse the repository at this point in the history
  • Loading branch information
iJungleboy committed Mar 1, 2019
1 parent 58bc7bb commit bf48dd7
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions 2sxc Dnn/Search/SearchController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using ToSic.SexyContent.Search;
using ToSic.Eav.DataSources.Caches;

// ReSharper disable once CheckNamespace
namespace ToSic.SexyContent.Environment.Dnn7.Search
{
internal class SearchController: HasLog
Expand All @@ -34,23 +35,19 @@ public IList<SearchDocument> GetModifiedSearchDocuments(IInstanceInfo instance,
var dnnModule = (instance as EnvironmentInstance<ModuleInfo>)?.Original;
// always log with method, to ensure errors are cought
Log.Add($"start search for mod#{dnnModule?.ModuleID}");

History.Add("dnn-search", Log);

if (dnnModule == null) return searchDocuments;

var isContentModule = dnnModule.DesktopModule.ModuleName == "2sxc";

// New Context because PortalSettings.Current is null
var zoneId = new DnnEnvironment(Log).ZoneMapper.GetZoneId(dnnModule.OwnerPortalID);

int? appId = null;

if (!isContentModule)
{
appId = new DnnMapAppToInstance(Log).GetAppIdFromInstance(instance, zoneId);
}
else
{
appId = new ZoneRuntime(zoneId, Log).DefaultAppId;
}
var appId = !isContentModule
? new DnnMapAppToInstance(Log).GetAppIdFromInstance(instance, zoneId)
: new ZoneRuntime(zoneId, Log).DefaultAppId;

if (!appId.HasValue)
return searchDocuments;
Expand Down

0 comments on commit bf48dd7

Please sign in to comment.