Skip to content
Permalink
Browse files

#1133 : Fixed issue where indexing commands referenced old job API.

  • Loading branch information...
michaellwest committed Sep 1, 2019
1 parent 90d7524 commit a38d76bc9e70dc41f8c54d74af86e417b3d3388c
@@ -35,6 +35,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Sitecore.ContentSearch, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Sitecore.ContentSearch.NoReferences.8.2.170728\lib\NET452\Sitecore.ContentSearch.dll</HintPath>
</Reference>
<Reference Include="Sitecore.Kernel, Version=10.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Sitecore.Kernel.NoReferences.8.2.170728\lib\NET452\Sitecore.Kernel.dll</HintPath>
<Private>False</Private>
@@ -49,6 +52,7 @@
<Compile Include="VersionDecoupling\Interfaces\IAuthenticationManager.cs" />
<Compile Include="VersionDecoupling\Interfaces\IDateConverter.cs" />
<Compile Include="VersionDecoupling\Interfaces\IImmediateDebugWindowLauncher.cs" />
<Compile Include="VersionDecoupling\Interfaces\IIndexManager.cs" />
<Compile Include="VersionDecoupling\Interfaces\IJob.cs" />
<Compile Include="VersionDecoupling\Interfaces\IJobManager.cs" />
<Compile Include="VersionDecoupling\Interfaces\IJobOptions.cs" />
@@ -0,0 +1,11 @@
using Sitecore.ContentSearch;

namespace Spe.Abstractions.VersionDecoupling.Interfaces
{
public interface IIndexManager
{
IJob DeleteItem(ISearchIndex index, IIndexableId indexableId);
IJob Refresh(ISearchIndex index, IIndexable indexable);
IJob FullRebuild(ISearchIndex index, bool isRemote);
}
}
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Sitecore.Client.NoReferences" version="8.2.170728" targetFramework="net452" developmentDependency="true" />
<package id="Sitecore.ContentSearch.NoReferences" version="8.2.170728" targetFramework="net452" developmentDependency="true" />
<package id="Sitecore.ExperienceEditor.NoReferences" version="8.2.170728" targetFramework="net452" developmentDependency="true" />
<package id="Sitecore.Kernel.NoReferences" version="8.2.170728" targetFramework="net452" developmentDependency="true" />
</packages>
@@ -0,0 +1,27 @@
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.Maintenance;
using Spe.Abstractions.VersionDecoupling.Interfaces;

namespace Spe.VersionSpecific.Services
{
public class SpeIndexManager : IIndexManager
{
public IJob DeleteItem(ISearchIndex index, IIndexableId indexableId)
{
var job = IndexCustodian.DeleteItem(index, indexableId);
return job == null ? null : new SpeJob(job);
}

public IJob Refresh(ISearchIndex index, IIndexable indexable)
{
var job = IndexCustodian.Refresh(index, indexable);
return job == null ? null : new SpeJob(job);
}

public IJob FullRebuild(ISearchIndex index, bool isRemote)
{
var job = (isRemote) ? IndexCustodian.FullRebuildRemote(index) : IndexCustodian.FullRebuild(index);
return job == null ? null : new SpeJob(job);
}
}
}
@@ -32,6 +32,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Sitecore.ContentSearch, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Sitecore.ContentSearch.NoReferences.8.2.170728\lib\NET452\Sitecore.ContentSearch.dll</HintPath>
</Reference>
<Reference Include="Sitecore.Kernel, Version=10.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Sitecore.Kernel.NoReferences.8.2.170728\lib\NET452\Sitecore.Kernel.dll</HintPath>
<Private>False</Private>
@@ -45,6 +48,7 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\SpeAuthenticationManager.cs" />
<Compile Include="Services\SpeIndexManager.cs" />
<Compile Include="Services\SpeJob.cs" />
<Compile Include="Services\SpeJobManager.cs" />
<Compile Include="Services\SpeJobOptions.cs" />
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Sitecore.ContentSearch.NoReferences" version="8.2.170728" targetFramework="net452" developmentDependency="true" />
<package id="Sitecore.Kernel.NoReferences" version="8.2.170728" targetFramework="net452" developmentDependency="true" />
</packages>
@@ -0,0 +1,27 @@
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.Maintenance;
using Spe.Abstractions.VersionDecoupling.Interfaces;

namespace Spe.VersionSpecific.Services
{
public class SpeIndexManager : IIndexManager
{
public IJob DeleteItem(ISearchIndex index, IIndexableId indexableId)
{
var job = IndexCustodian.DeleteItem(index, indexableId);
return job == null ? null : new SpeJob(job);
}

public IJob Refresh(ISearchIndex index, IIndexable indexable)
{
var job = IndexCustodian.Refresh(index, indexable);
return job == null ? null : new SpeJob(job);
}

public IJob FullRebuild(ISearchIndex index, bool isRemote)
{
var job = (isRemote) ? IndexCustodian.FullRebuildRemote(index) : IndexCustodian.FullRebuild(index);
return job == null ? null : new SpeJob(job);
}
}
}
@@ -32,6 +32,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Sitecore.ContentSearch, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Sitecore.ContentSearch.9.2.0\lib\net471\Sitecore.ContentSearch.dll</HintPath>
</Reference>
<Reference Include="Sitecore.Kernel, Version=13.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Sitecore.Kernel.9.2.0\lib\net471\Sitecore.Kernel.dll</HintPath>
<Private>False</Private>
@@ -41,6 +44,7 @@
<Reference Include="System.Design" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.IO.FileSystem.Primitives" />
<Reference Include="System.Runtime.Caching" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Web" />
@@ -54,6 +58,7 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\SpeAuthenticationManager.cs" />
<Compile Include="Services\SpeIndexManager.cs" />
<Compile Include="Services\SpeJob.cs" />
<Compile Include="Services\SpeJobManager.cs" />
<Compile Include="Services\SpeJobOptions.cs" />
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Sitecore.ContentSearch" version="9.2.0" targetFramework="net471" />
<package id="Sitecore.Kernel" version="9.2.0" targetFramework="net471" />
</packages>
@@ -47,6 +47,7 @@
<mapping name="IAuthenticationManager" type="Spe.VersionSpecific.Services.SpeAuthenticationManager, Spe.VersionSpecific" />
<mapping name="IObsoletor" type="Spe.VersionSpecific.Services.SpeObsoletor, Spe.VersionSpecific" />
<mapping name="IPublishManager" type="Spe.VersionSpecific.Services.SpePublishManager, Spe.VersionSpecific" />
<mapping name="IIndexManager" type="Spe.VersionSpecific.Services.SpeIndexManager, Spe.VersionSpecific" />
</typeMappings>
<settings>
<setting name="Spe.CommandWaitMillis" value="25" />
@@ -61,7 +61,8 @@ private void RebuildIndex(ISearchIndex index, bool isRemoteIndex = false)
else
{
WriteVerbose($"Starting full index rebuild for {index.Name}.");
var job = (isRemoteIndex) ? IndexCustodian.FullRebuildRemote(index) : IndexCustodian.FullRebuild(index);
var indexManager = TypeResolver.ResolveFromCache<IIndexManager>();
var job = indexManager.FullRebuild(index, isRemoteIndex);

if (job == null || !AsJob) return;

@@ -4,7 +4,9 @@
using Sitecore.ContentSearch.Maintenance;
using Sitecore.ContentSearch.SearchTypes;
using Sitecore.Data.Items;
using Spe.Abstractions.VersionDecoupling.Interfaces;
using Spe.Core.Extensions;
using Spe.Core.VersionDecoupling;

namespace Spe.Commands.Data.Search
{
@@ -56,13 +58,13 @@ protected override void ProcessRecord()
private void RefreshItem(ISearchIndex index, IIndexable indexable, string itemPath)
{
WriteVerbose($"Starting index rebuild for item {itemPath} in {index.Name}.");
var job = IndexCustodian.Refresh(index, indexable);
var indexManager = TypeResolver.ResolveFromCache<IIndexManager>();
var job = indexManager.Refresh(index, indexable);

if (job != null && AsJob)
{
WriteVerbose($"Background job created: {job.Name}");
WriteObject(job);
}
if (job == null || !AsJob) return;

WriteVerbose($"Background job created: {job.Name}");
WriteObject(job);
}
}
}
@@ -4,7 +4,9 @@
using Sitecore.ContentSearch.Maintenance;
using Sitecore.ContentSearch.SearchTypes;
using Sitecore.Data.Items;
using Spe.Abstractions.VersionDecoupling.Interfaces;
using Spe.Core.Extensions;
using Spe.Core.VersionDecoupling;

namespace Spe.Commands.Data.Search
{
@@ -53,13 +55,13 @@ protected override void ProcessRecord()
private void DeleteItem(ISearchIndex index, IIndexableId indexableId, string itemPath)
{
WriteVerbose($"Removing item {itemPath} from index {index.Name}.");
var job = IndexCustodian.DeleteItem(index, indexableId);
var indexManager = TypeResolver.ResolveFromCache<IIndexManager>();
var job = indexManager.DeleteItem(index, indexableId);

if (job != null && AsJob)
{
WriteVerbose($"Background job created: {job.Name}");
WriteObject(job);
}
if (job == null || !AsJob) return;

WriteVerbose($"Background job created: {job.Name}");
WriteObject(job);
}
}
}

0 comments on commit a38d76b

Please sign in to comment.
You can’t perform that action at this time.