V8: Indexing of grid values containing JSON (#6201)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
4dad427a64
commit
b254b4fcda
@@ -41,8 +41,6 @@ namespace Umbraco.Web.PropertyEditors
|
|||||||
{
|
{
|
||||||
var controlVal = control.Value;
|
var controlVal = control.Value;
|
||||||
|
|
||||||
// TODO: If it's not a string, then it's a json formatted value -
|
|
||||||
// we cannot really index this in a smart way since it could be 'anything'
|
|
||||||
if (controlVal?.Type == JTokenType.String)
|
if (controlVal?.Type == JTokenType.String)
|
||||||
{
|
{
|
||||||
var str = controlVal.Value<string>();
|
var str = controlVal.Value<string>();
|
||||||
@@ -53,14 +51,22 @@ namespace Umbraco.Web.PropertyEditors
|
|||||||
//add the row name as an individual field
|
//add the row name as an individual field
|
||||||
result.Add(new KeyValuePair<string, IEnumerable<object>>($"{property.Alias}.{rowName}", new[] { str }));
|
result.Add(new KeyValuePair<string, IEnumerable<object>>($"{property.Alias}.{rowName}", new[] { str }));
|
||||||
}
|
}
|
||||||
|
else if (controlVal is JContainer jc)
|
||||||
|
{
|
||||||
|
foreach (var s in jc.Descendants().Where(t => t.Type == JTokenType.String))
|
||||||
|
{
|
||||||
|
sb.Append(s.Value<string>());
|
||||||
|
sb.Append(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//First save the raw value to a raw field
|
||||||
|
result.Add(new KeyValuePair<string, IEnumerable<object>>($"{UmbracoExamineIndex.RawFieldPrefix}{property.Alias}", new[] { rawVal }));
|
||||||
|
|
||||||
if (sb.Length > 0)
|
if (sb.Length > 0)
|
||||||
{
|
{
|
||||||
//First save the raw value to a raw field
|
|
||||||
result.Add(new KeyValuePair<string, IEnumerable<object>>($"{UmbracoExamineIndex.RawFieldPrefix}{property.Alias}", new[] { rawVal }));
|
|
||||||
|
|
||||||
//index the property with the combined/cleaned value
|
//index the property with the combined/cleaned value
|
||||||
result.Add(new KeyValuePair<string, IEnumerable<object>>(property.Alias, new[] { sb.ToString() }));
|
result.Add(new KeyValuePair<string, IEnumerable<object>>(property.Alias, new[] { sb.ToString() }));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user