Handling multiple values per field in Examine Management

This commit is contained in:
Callum Whyte
2021-02-22 07:18:31 +00:00
committed by Nathan Woulfe
parent 9ac4eacdbd
commit 121ae2e8a9
3 changed files with 6 additions and 13 deletions

View File

@@ -18,9 +18,9 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="(key, val) in model.searchResultValues track by key">
<tr ng-repeat="(key, values) in model.searchResultValues track by key">
<td>{{key}}</td>
<td style="word-break: break-word;">{{val}}</td>
<td style="word-break: break-word;">{{values | umbCmsJoinArray:', '}}</td>
</tr>
</tbody>
</table>

View File

@@ -25,7 +25,6 @@ namespace Umbraco.Web.Editors
private readonly IAppPolicyCache _runtimeCache;
private readonly IndexRebuilder _indexRebuilder;
public ExamineManagementController(IExamineManager examineManager, ILogger logger,
AppCaches appCaches,
IndexRebuilder indexRebuilder)
@@ -79,14 +78,11 @@ namespace Umbraco.Web.Editors
{
Id = x.Id,
Score = x.Score,
//order the values by key
Values = new Dictionary<string, string>(x.Values.OrderBy(y => y.Key).ToDictionary(y => y.Key, y => y.Value))
Values = x.AllValues.OrderBy(y => y.Key).ToDictionary(y => y.Key, y => y.Value)
})
};
}
/// <summary>
/// Check if the index has been rebuilt
/// </summary>
@@ -113,7 +109,6 @@ namespace Umbraco.Web.Editors
return found != null
? null
: CreateModel(index);
}
/// <summary>
@@ -167,8 +162,6 @@ namespace Umbraco.Web.Editors
}
}
private ExamineIndexModel CreateModel(IIndex index)
{
var indexName = index.Name;
@@ -182,11 +175,13 @@ namespace Umbraco.Web.Editors
}
var isHealth = indexDiag.IsHealthy();
var properties = new Dictionary<string, object>
{
[nameof(IIndexDiagnostics.DocumentCount)] = indexDiag.DocumentCount,
[nameof(IIndexDiagnostics.FieldCount)] = indexDiag.FieldCount,
};
foreach (var p in indexDiag.Metadata)
properties[p.Key] = p.Value;
@@ -198,7 +193,6 @@ namespace Umbraco.Web.Editors
CanRebuild = _indexRebuilder.CanRebuild(index)
};
return indexerModel;
}
@@ -211,7 +205,6 @@ namespace Umbraco.Web.Editors
return Request.CreateResponse(HttpStatusCode.OK);
}
//if we didn't find anything try to find it by an explicitly declared searcher
if (_examineManager.TryGetSearcher(searcherName, out searcher))
return Request.CreateResponse(HttpStatusCode.OK);

View File

@@ -16,6 +16,6 @@ namespace Umbraco.Web.Models.ContentEditing
public int FieldCount => Values?.Count ?? 0;
[DataMember(Name = "values")]
public IReadOnlyDictionary<string, string> Values { get; set; }
public IReadOnlyDictionary<string, IReadOnlyList<string>> Values { get; set; }
}
}