After upgrading from Umbraco 10 to Umbraco 13, the directory indexing no longer writes any geo-coordinates to Algolia. Previously (on Umbraco 10) each record included _geoloc
(lat/lng) and radius searches worked. On Umbraco 13, the indexed JSON has no _geoloc
or geolocation
attribute, so ?query=London&distance=25
returns 0 results.
Steps to reproduce
- Install Umbraco.Cms.Integrations.Search.Algolia v2.3.1 on Umbraco 13.4.1
- Add and register a
RidingCentreRecordBuilder
subclass ofBaseLocationRecordBuilder
:
csharp
CopyEdit
builder.Services.AddScoped<IRecordBuilder<RidingCentrePage>, RidingCentreRecordBuilder>();
- Configure the directory in back-office → Package Settings → “Indexing Directory” → click Build.
- In the Algolia Dashboard, open the index and click Browse.
Expected
Each record should contain a geo-attribute (_geoloc
or geolocation
) with latitude/longitude derived from location_googlemaps
.
Actual
No geo-attribute is present. The location_googlemaps
field in the record is [null]
, and there is no _geoloc
or geolocation
entry.
Custom code
csharp
CopyEdit
// CustomAlgoliaComposer.cs
public class CustomAlgoliaComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.Services.AddScoped<IRecordBuilder<RidingCentrePage>, RidingCentreRecordBuilder>();
// … other record builders …
}
}
// RidingCentreRecordBuilder.cs
public class RidingCentreRecordBuilder
: BaseLocationRecordBuilder, IRecordBuilder<RidingCentrePage>
{
public RidingCentreRecordBuilder(IPublishedSnapshotAccessor acc)
: base(acc) { }
protected override string GetLocationAlias()
=> RidingCentrePage
.GetModelPropertyType(_publishedSnapshotAccessor, x => x.Location_googlemaps)
.Alias;
}
Sample indexed record
json
CopyEdit
{
"objectID": "ffb773db-c9d5-471d-ac63-31f6b63f3048",
"name": "Little Munden Equestrian",
"data": {
"location_googlemaps": [null],
"clients": [null],
// …
},
// no _geoloc or geolocation
}
Notes
- The same code works on Umbraco 10 with v2.3.1 of the package.
- It appears geo-mapping via
BaseLocationRecordBuilder
is not being invoked on Umbraco 13.
Questions
- Is there a breaking change in v2.3.1 or Umbraco 13 that disables
BaseLocationRecordBuilder
-based geo-indexing? - What’s the correct way to restore
_geoloc
(orgeolocation
) indexing in this version?