Skip to content

Commit d2fa671

Browse files
committed
Pass content object to geolocation interface
1 parent 23b897e commit d2fa671

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/Umbraco.Cms.Integrations.Search.Algolia/Builders/ContentRecordBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public ContentRecordBuilder BuildFromContent(IContent content, Func<IProperty, b
7070
_record.Path = content.Path.Split(',').ToList();
7171
_record.ContentTypeAlias = content.ContentType.Alias;
7272
_record.Url = _urlProvider.GetUrl(content.Id);
73-
_record.GeolocationData = _algoliaGeolocationProvider.GetGeolocationAsync().ConfigureAwait(false).GetAwaiter().GetResult();
73+
_record.GeolocationData = _algoliaGeolocationProvider.GetGeolocationAsync(content).ConfigureAwait(false).GetAwaiter().GetResult();
7474
_record.Data = new();
7575

7676
if (content.PublishedCultures.Count() > 0)

src/Umbraco.Cms.Integrations.Search.Algolia/Services/AlgoliaIndexService.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ namespace Umbraco.Cms.Integrations.Search.Algolia.Services
1111
public class AlgoliaIndexService : IAlgoliaIndexService
1212
{
1313
private readonly AlgoliaSettings _settings;
14-
private readonly IAlgoliaGeolocationProvider _algoliaGeolocationProvider;
1514

16-
public AlgoliaIndexService(IOptions<AlgoliaSettings> options, IAlgoliaGeolocationProvider algoliaGeolocationProvider)
15+
public AlgoliaIndexService(IOptions<AlgoliaSettings> options)
1716
{
1817
_settings = options.Value;
19-
_algoliaGeolocationProvider = algoliaGeolocationProvider;
2018
}
2119

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
using Umbraco.Cms.Integrations.Search.Algolia.Models;
1+
using Umbraco.Cms.Core.Models;
2+
using Umbraco.Cms.Integrations.Search.Algolia.Models;
23

34
namespace Umbraco.Cms.Integrations.Search.Algolia.Services
45
{
56
public class AlgoliaNullGeolocationProvider : IAlgoliaGeolocationProvider
67
{
7-
public async Task<List<GeolocationEntity>> GetGeolocationAsync() => null;
8+
public async Task<List<GeolocationEntity>> GetGeolocationAsync(IContent content) => null;
89
}
910
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
using Umbraco.Cms.Integrations.Search.Algolia.Models;
1+
using Umbraco.Cms.Core.Models;
2+
using Umbraco.Cms.Integrations.Search.Algolia.Models;
23

34
namespace Umbraco.Cms.Integrations.Search.Algolia.Services
45
{
56
public interface IAlgoliaGeolocationProvider
67
{
7-
Task<List<GeolocationEntity>> GetGeolocationAsync();
8+
Task<List<GeolocationEntity>> GetGeolocationAsync(IContent content);
89
}
910
}

src/Umbraco.Cms.Integrations.Search.Algolia/Umbraco.Cms.Integrations.Search.Algolia.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<PackageIconUrl></PackageIconUrl>
1414
<PackageProjectUrl>https://github.com/umbraco/Umbraco.Cms.Integrations/tree/main/src/Umbraco.Cms.Integrations.Search.Algolia</PackageProjectUrl>
1515
<RepositoryUrl>https://github.com/umbraco/Umbraco.Cms.Integrations</RepositoryUrl>
16-
<Version>3.1.0</Version>
16+
<Version>3.1.1</Version>
1717
<Authors>Umbraco HQ</Authors>
1818
<Company>Umbraco</Company>
1919
<PackageTags>Umbraco;Umbraco-Marketplace</PackageTags>

0 commit comments

Comments
 (0)