Algolia and firebase database 'map' field with Algolia vuejs

hey there folks :slight_smile: I just fired up my first firebase database and noticed that they actually have a map field that you can add. Is there anyone here who knows how to use it with Algolia geosearch (vuejs)?

Hi @lindamacdonalde, I’m not a firebase expert, but I’ve used it before. If I look at “map field” on their documentation I come to: https://firebase.google.com/docs/firestore/solutions/index-map-field, which seems to be about mapping (like array.map), not about geolocation.

Regardless of that, you can use the _geoLoc field in the indexing to Algolia. What you need to do is in the hook where you create objects in algolia, transform it to add a _geoLoc attribute. You can read more on how to use that here: https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#geo-search

Hey there Haroen thanks for your quick reply. My appologoes - it’s called geopoint when you add that field it gives you two boxes one for latitude and one for longditude so it seems very simple to use - only problem being I don’t quite know how to integrate it with Algolia vuejs?

1 Like

I haven’t used functions yet, but it’s either _latitude / _longitude, or .geoPointObj.latitude, which you can then transform to _geoLoc

source: https://stackoverflow.com/a/53543013/3185307

You can also log the whole document to see what the name of the property is