Skip to content

[SEARCH FUNCTION DOWN] Geolocation not indexed in Algolia v2.3.1 on Umbraco 13 (no _geoloc or geolocation field) #269

@iksweliwita

Description

@iksweliwita

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 of BaseLocationRecordBuilder:

csharp

builder.Services.AddScoped<IRecordBuilder, 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

// CustomAlgoliaComposer.cs
public class CustomAlgoliaComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.Services.AddScoped<IRecordBuilder, RidingCentreRecordBuilder>();
// … other record builders …
}
}

// RidingCentreRecordBuilder.cs
public class RidingCentreRecordBuilder
: BaseLocationRecordBuilder, IRecordBuilder
{
public RidingCentreRecordBuilder(IPublishedSnapshotAccessor acc)
: base(acc) { }

protected override string GetLocationAlias()
    => RidingCentrePage
         .GetModelPropertyType(_publishedSnapshotAccessor, x => x.Location_googlemaps)
         .Alias;

}
Sample indexed record

json

{
"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 (or geolocation) indexing in this version?


This item has been added to our backlog AB#54770

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions