Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,27 @@ public AllIndexerController(
[ProducesResponseType(typeof(PagedViewModel<IndexResponseModel>), StatusCodes.Status200OK)]
[EndpointSummary("Gets a collection of indexers.")]
[EndpointDescription("Gets a collection of configured search indexers in the Umbraco installation.")]
public Task<PagedViewModel<IndexResponseModel>> All(
public async Task<PagedViewModel<IndexResponseModel>> All(
CancellationToken cancellationToken,
int skip = 0,
int take = 100)
{
IndexResponseModel[] indexes = _examineManager.Indexes
.Select(_indexPresentationFactory.Create)
.OrderBy(indexModel => indexModel.Name.TrimEnd("Indexer")).ToArray();
var indexes = new List<IndexResponseModel>();

var viewModel = new PagedViewModel<IndexResponseModel> { Items = indexes.Skip(skip).Take(take), Total = indexes.Length };
return Task.FromResult(viewModel);
foreach (IIndex index in _examineManager.Indexes)
{
indexes.Add(await _indexPresentationFactory.CreateAsync(index));
}

indexes.Sort((a, b) =>
string.Compare(a.Name.TrimEnd("Indexer"), b.Name.TrimEnd("Indexer"), StringComparison.Ordinal));

var viewModel = new PagedViewModel<IndexResponseModel>
{
Items = indexes.Skip(skip).Take(take),
Total = indexes.Count,
};

return viewModel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public DetailsIndexerController(
[ProducesResponseType(typeof(IndexResponseModel), StatusCodes.Status200OK)]
[EndpointSummary("Gets indexer details.")]
[EndpointDescription("Gets detailed information about the indexer identified by the provided name.")]
public Task<ActionResult<IndexResponseModel?>> Details(CancellationToken cancellationToken, string indexName)
public async Task<ActionResult<IndexResponseModel?>> Details(CancellationToken cancellationToken, string indexName)
{
if (_examineManager.TryGetIndex(indexName, out IIndex? index))
{
return Task.FromResult<ActionResult<IndexResponseModel?>>(_indexPresentationFactory.Create(index));
return await _indexPresentationFactory.CreateAsync(index);
}

var invalidModelProblem = new ProblemDetails
Expand All @@ -52,6 +52,6 @@ public DetailsIndexerController(
Type = "Error",
};

return Task.FromResult<ActionResult<IndexResponseModel?>>(NotFound(invalidModelProblem));
return NotFound(invalidModelProblem);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ public static IUmbracoBuilder AddExamine(this IUmbracoBuilder builder)

builder.Services.AddUnique<IDeliveryApiCompositeIdHandler, DeliveryApiCompositeIdHandler>();

builder.Services.AddTransient<IIndexRebuilder, ExamineIndexRebuilder>();

builder.AddNotificationHandler<ContentCacheRefresherNotification, ContentIndexingNotificationHandler>();
builder.AddNotificationHandler<PublicAccessCacheRefresherNotification, ContentIndexingNotificationHandler>();
builder.AddNotificationHandler<ContentTypeCacheRefresherNotification, ContentTypeIndexingNotificationHandler>();
Expand Down
Loading
Loading