Updates to latest examine, fixes issue with rebuilding indexes in the back office seeming to timeout but was a problem with the callback registration in examine

This commit is contained in:
Shannon
2019-01-07 18:16:06 +11:00
parent 118ad5361a
commit 0356e5a224
7 changed files with 26 additions and 22 deletions

View File

@@ -25,7 +25,7 @@
<dependency id="ClientDependency" version="[1.9.7,1.999999)" />
<dependency id="ClientDependency-Mvc5" version="[1.8.0,1.999999)" />
<dependency id="CSharpTest.Net.Collections" version="[14.906.1403.1082,14.999999)" />
<dependency id="Examine" version="[1.0.0-beta067,1.999999)" />
<dependency id="Examine" version="[1.0.0-beta072,1.999999)" />
<dependency id="HtmlAgilityPack" version="[1.8.9,1.999999)" />
<dependency id="ImageProcessor" version="[2.6.2.25,2.999999)" />
<dependency id="LightInject.Mvc" version="[2.0.0,2.999999)" />

View File

@@ -48,7 +48,7 @@
</ItemGroup>
<ItemGroup>
<!-- note: NuGet deals with transitive references now -->
<PackageReference Include="Examine" Version="1.0.0-beta068" />
<PackageReference Include="Examine" Version="1.0.0-beta072" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NPoco" Version="3.9.4" />
</ItemGroup>

View File

@@ -92,8 +92,8 @@ namespace Umbraco.Examine
//these are the invalid items so we'll delete them
//since the path is not valid we need to delete this item in case it exists in the index already and has now
//been moved to an invalid parent.
foreach (var i in group)
base.PerformDeleteFromIndex(i.Id, args => { /*noop*/ });
base.PerformDeleteFromIndex(group.Select(x => x.Id), args => { /*noop*/ });
}
else
{
@@ -118,24 +118,28 @@ namespace Umbraco.Examine
/// When a content node is deleted, we also need to delete it's children from the index so we need to perform a
/// custom Lucene search to find all decendents and create Delete item queues for them too.
/// </remarks>
/// <param name="nodeId">ID of the node to delete</param>
/// <param name="itemIds">ID of the node to delete</param>
/// <param name="onComplete"></param>
protected override void PerformDeleteFromIndex(string nodeId, Action<IndexOperationEventArgs> onComplete)
protected override void PerformDeleteFromIndex(IEnumerable<string> itemIds, Action<IndexOperationEventArgs> onComplete)
{
//find all descendants based on path
var descendantPath = $@"\-1\,*{nodeId}\,*";
var rawQuery = $"{IndexPathFieldName}:{descendantPath}";
var searcher = GetSearcher();
var c = searcher.CreateQuery();
var filtered = c.NativeQuery(rawQuery);
var results = filtered.Execute();
var idsAsList = itemIds.ToList();
foreach (var nodeId in idsAsList)
{
//find all descendants based on path
var descendantPath = $@"\-1\,*{nodeId}\,*";
var rawQuery = $"{IndexPathFieldName}:{descendantPath}";
var searcher = GetSearcher();
var c = searcher.CreateQuery();
var filtered = c.NativeQuery(rawQuery);
var results = filtered.Execute();
ProfilingLogger.Debug(GetType(), "DeleteFromIndex with query: {Query} (found {TotalItems} results)", rawQuery, results.TotalItemCount);
ProfilingLogger.Debug(GetType(), "DeleteFromIndex with query: {Query} (found {TotalItems} results)", rawQuery, results.TotalItemCount);
//need to queue a delete item for each one found
QueueIndexOperation(results.Select(r => new IndexOperation(new ValueSet(r.Id), IndexOperationType.Delete)));
//need to queue a delete item for each one found
QueueIndexOperation(results.Select(r => new IndexOperation(new ValueSet(r.Id), IndexOperationType.Delete)));
}
base.PerformDeleteFromIndex(nodeId, onComplete);
base.PerformDeleteFromIndex(idsAsList, onComplete);
}
}

View File

@@ -94,13 +94,13 @@ namespace Umbraco.Examine
/// <remarks>
/// This check is required since the base examine lib will try to rebuild on startup
/// </remarks>
protected override void PerformDeleteFromIndex(string nodeId, Action<IndexOperationEventArgs> onComplete)
protected override void PerformDeleteFromIndex(IEnumerable<string> itemIds, Action<IndexOperationEventArgs> onComplete)
{
if (CanInitialize())
{
using (new SafeCallContext())
{
base.PerformDeleteFromIndex(nodeId, onComplete);
base.PerformDeleteFromIndex(itemIds, onComplete);
}
}
}

View File

@@ -77,7 +77,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="7.0.1" />
<PackageReference Include="Castle.Core" Version="4.2.1" />
<PackageReference Include="Examine" Version="1.0.0-beta068" />
<PackageReference Include="Examine" Version="1.0.0-beta072" />
<PackageReference Include="HtmlAgilityPack">
<Version>1.8.9</Version>
</PackageReference>

View File

@@ -88,7 +88,7 @@
<PackageReference Include="CSharpTest.Net.Collections" Version="14.906.1403.1082" />
<PackageReference Include="ClientDependency" Version="1.9.7" />
<PackageReference Include="ClientDependency-Mvc5" Version="1.8.0.0" />
<PackageReference Include="Examine" Version="1.0.0-beta068" />
<PackageReference Include="Examine" Version="1.0.0-beta072" />
<PackageReference Include="ImageProcessor.Web" Version="4.9.3.25" />
<PackageReference Include="ImageProcessor.Web.Config" Version="2.4.1.19" />
<PackageReference Include="Microsoft.AspNet.Identity.Owin" Version="2.2.2" />

View File

@@ -63,7 +63,7 @@
<PackageReference Include="AutoMapper" Version="7.0.1" />
<PackageReference Include="ClientDependency" Version="1.9.7" />
<PackageReference Include="CSharpTest.Net.Collections" Version="14.906.1403.1082" />
<PackageReference Include="Examine" Version="1.0.0-beta068" />
<PackageReference Include="Examine" Version="1.0.0-beta072" />
<PackageReference Include="HtmlAgilityPack" Version="1.8.9" />
<PackageReference Include="ImageProcessor">
<Version>2.6.2.25</Version>