Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -70,7 +70,7 @@ public ContentRecordBuilder BuildFromContent(IContent content, Func<IProperty, b
_record.Path = content.Path.Split(',').ToList();
_record.ContentTypeAlias = content.ContentType.Alias;
_record.Url = _urlProvider.GetUrl(content.Id);
_record.GeolocationData = _algoliaGeolocationProvider.GetGeolocationAsync().ConfigureAwait(false).GetAwaiter().GetResult();
_record.GeolocationData = _algoliaGeolocationProvider.GetGeolocationAsync(content).ConfigureAwait(false).GetAwaiter().GetResult();
_record.Data = new();

if (content.PublishedCultures.Count() > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ namespace Umbraco.Cms.Integrations.Search.Algolia.Services
public class AlgoliaIndexService : IAlgoliaIndexService
{
private readonly AlgoliaSettings _settings;
private readonly IAlgoliaGeolocationProvider _algoliaGeolocationProvider;

public AlgoliaIndexService(IOptions<AlgoliaSettings> options, IAlgoliaGeolocationProvider algoliaGeolocationProvider)
public AlgoliaIndexService(IOptions<AlgoliaSettings> options)
{
_settings = options.Value;
_algoliaGeolocationProvider = algoliaGeolocationProvider;
}

public async Task<Result> PushData(string name, List<Record> payload = null)
Expand All @@ -32,7 +30,7 @@ await index.SaveObjectsAsync(payload != null
: new List<Record> {
new Record {
ObjectID = Guid.NewGuid().ToString(),
GeolocationData = await _algoliaGeolocationProvider.GetGeolocationAsync(),
GeolocationData = null,
Data = new Dictionary<string, object>()}
}, autoGenerateObjectId: false);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Umbraco.Cms.Integrations.Search.Algolia.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Integrations.Search.Algolia.Models;

namespace Umbraco.Cms.Integrations.Search.Algolia.Services
{
public class AlgoliaNullGeolocationProvider : IAlgoliaGeolocationProvider
{
public async Task<List<GeolocationEntity>> GetGeolocationAsync() => null;
public async Task<List<GeolocationEntity>> GetGeolocationAsync(IContent content) => null;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Umbraco.Cms.Integrations.Search.Algolia.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Integrations.Search.Algolia.Models;

namespace Umbraco.Cms.Integrations.Search.Algolia.Services
{
public interface IAlgoliaGeolocationProvider
{
Task<List<GeolocationEntity>> GetGeolocationAsync();
Task<List<GeolocationEntity>> GetGeolocationAsync(IContent content);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageIconUrl></PackageIconUrl>
<PackageProjectUrl>https://github.com/umbraco/Umbraco.Cms.Integrations/tree/main/src/Umbraco.Cms.Integrations.Search.Algolia</PackageProjectUrl>
<RepositoryUrl>https://github.com/umbraco/Umbraco.Cms.Integrations</RepositoryUrl>
<Version>2.3.0</Version>
<Version>2.3.1</Version>
<Authors>Umbraco HQ</Authors>
<Company>Umbraco</Company>
<PackageTags>Umbraco;Umbraco-Marketplace</PackageTags>
Expand Down