Fixes issue with dynamically creating/storing field definitions, latest examine update
This commit is contained in:
@@ -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-beta072,1.999999)" />
|
||||
<dependency id="Examine" version="[1.0.0-beta078,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)" />
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<!-- note: NuGet deals with transitive references now -->
|
||||
<PackageReference Include="Examine" Version="1.0.0-beta076" />
|
||||
<PackageReference Include="Examine" Version="1.0.0-beta078" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
<PackageReference Include="NPoco" Version="3.9.4" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -61,6 +61,11 @@ namespace Umbraco.Examine
|
||||
/// For example, we have things like `nodeName` and `__Published` which are also used for culture fields like `nodeName_en-us`
|
||||
/// and we don't want to have a full static list of all of these definitions when we can just define the one definition and then
|
||||
/// dynamically apply that to culture specific fields.
|
||||
///
|
||||
/// There is a caveat to this however, when a field definition is found for a non-culture field we will create and store a new field
|
||||
/// definition for that culture so that the next time it needs to be looked up and used we are not allocating more objects. This does mean
|
||||
/// however that if a language is deleted, the field definitions for that language will still exist in memory. This isn't going to cause any
|
||||
/// problems and the mem will be cleared on next site restart but it's worth pointing out.
|
||||
/// </remarks>
|
||||
public override bool TryGetValue(string fieldName, out FieldDefinition fieldDefinition)
|
||||
{
|
||||
@@ -68,9 +73,7 @@ namespace Umbraco.Examine
|
||||
return true;
|
||||
|
||||
//before we use regex to match do some faster simple matching since this is going to execute quite a lot
|
||||
if (!fieldName.Contains("_"))
|
||||
return false;
|
||||
if (!fieldName.Contains("-"))
|
||||
if (!fieldName.Contains("_") || !fieldName.Contains("-"))
|
||||
return false;
|
||||
|
||||
var match = ExamineExtensions.CultureIsoCodeFieldNameMatchExpression.Match(fieldName);
|
||||
@@ -78,8 +81,12 @@ namespace Umbraco.Examine
|
||||
{
|
||||
var nonCultureFieldName = match.Groups[1].Value;
|
||||
//check if there's a definition for this and if so return the field definition for the culture field based on the non-culture field
|
||||
if (base.TryGetValue(nonCultureFieldName, out fieldDefinition))
|
||||
if (base.TryGetValue(nonCultureFieldName, out var existingFieldDefinition))
|
||||
{
|
||||
//now add a new field def
|
||||
fieldDefinition = GetOrAdd(fieldName, s => new FieldDefinition(s, existingFieldDefinition.Type));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -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-beta076" />
|
||||
<PackageReference Include="Examine" Version="1.0.0-beta078" />
|
||||
<PackageReference Include="HtmlAgilityPack">
|
||||
<Version>1.8.9</Version>
|
||||
</PackageReference>
|
||||
|
||||
@@ -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-beta076" />
|
||||
<PackageReference Include="Examine" Version="1.0.0-beta078" />
|
||||
<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" />
|
||||
|
||||
@@ -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-beta076" />
|
||||
<PackageReference Include="Examine" Version="1.0.0-beta078" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.8.9" />
|
||||
<PackageReference Include="ImageProcessor">
|
||||
<Version>2.6.2.25</Version>
|
||||
|
||||
Reference in New Issue
Block a user