#community-help

Using Multiple Geo Fields with Typesense-Instantsearch-Adapter

TLDR Jainil inquired about using multiple geo fields with typesense-instantsearch-adapter. Jason explained that Instantsearch does not support multiple geo fields, suggesting they build their own UI.

Powered by Struct AI
8
5mo
Solved
Join the chat
May 05, 2023 (5 months ago)
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
08:20 PM
For the typesense-instantsearch-adapter, I see that for geo_search, we need to specify it when initializing the field name for the adapter. What happens if we have multiple fields for geo_search?
https://github.com/typesense/typesense-instantsearch-adapter#geosearch
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
08:21 PM
Could you give me an example where you’d want to use multiple geo fields?
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
08:23 PM
We have both a city that a user is currently located in, and what cities the user is open to moving to.
We want the ability to filter over both -
• "Give me all users who are currently living in/around NY and open to moving to/around SF"
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
08:27 PM
And both these fields are lat longs?
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
08:27 PM
Yep!
08:28
Jainil
08:28 PM
(The second field is a lat long array)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
08:28 PM
Interesting! Unfortunately, Instantsearch doesn’t allow a way to use multiple geo fields, since Algolia (who built Instantsearch) does not support multiple geo fields in the same record
08:28
Jason
08:28 PM
So you would have to build your own UI to be able to do something like this