This message was deleted.
# community-help
s
This message was deleted.
j
Could you inspect the network request in the browser, and share the full post body in the request sent to Typesense?
a
Copy code
curl 'http://0.0.0.0:8108/multi_search?use_cache=true&x-typesense-api-key=adminkey-4Uyafrcjob4EBsJsG37fFYQKQDFBLM' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Accept-Language: en-US,en-IN;q=0.9,en;q=0.8' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: text/plain' \
  -H 'Origin: http://localhost:3010' \
  -H 'Referer: http://localhost:3010/' \
  -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36' \
  --data-raw '{"searches":[{"query_by":"full_name","min_len_2typo":8,"split_join_tokens":"fallback","sort_by":"update_time:asc","per_page":40,"highlight_full_fields":"full_name","collection":"people_index","q":"*","facet_by":"location_city_geo_map,location_geo,org_funding_types_all,org_funding_types_current,org_industries_current,org_industry_groups_current,org_sizes_current","filter_by":"location_geo:=[`(56.33, -65.97, 20 mi)`]","max_facet_values":40,"page":1},{"query_by":"full_name","min_len_2typo":8,"split_join_tokens":"fallback","sort_by":"update_time:asc","per_page":40,"highlight_full_fields":"full_name","collection":"people_index","q":"*","facet_by":"location_geo","max_facet_values":40,"page":1}]}' \
  --compressed \
  --insecure
Yeah, sure, this is what the curl request looks on my local. Let me know if you need anything else.
j
This is the problematic part:
Copy code
"filter_by": "location_geo:=[`(56.33, -65.97, 20 mi)`]"
It should have been:
Copy code
"filter_by": "location_geo:=(56.33, -65.97, 20 mi)"
I think we can address this in the typesense-instantsearch-adapter... Let me try and get back to you
Could you create a GitHub issue for this, so we can track it?
a
Yeah, sure, will create the github issue.
Created one here. Let me know if you need any other details.
j
That's good, thank you
🙌 1
@Ankit Arora I started looking into this, but I haven't used this custom refine() method before, so I'm not sure how it plugs into the rest of the widgets just yet. In the meantime, I stumbled on this method, in the algolia-helper library that lets you set custom search parameters... Do you have access to the helper object inside the object? Then you can do something like this:
Copy code
helper.setQueryParameter('aroundRadius', '5 km');
helper.setQueryParameter(''aroundLatLng'', "latitude, longitude");
This is documented here: https://github.com/algolia/instantsearch/tree/master/packages/algoliasearch-helper/documentation-src#list-of-parameters-that-can-be-set
a
I'll check in detail but I don't think I have access to the helper object, using this react-instantsearch. The use case is I have 2 custom frontend components - one to select a city and another to select a radius. I do the translation to the city to lat/lng and then I need to pass a lat/lng and radius to refine the results. Any advice on the last part would be helpful, will explore this helper in the meanwhile and see if I can get access to it.
j
How would you do this in Algolia do you know? Because even with Algolia I don’t think geo settings are considered facet refinements…
You might have to use the configure widget to change aroundRadius dynamically
a
Yeah, I didn't have something like this in Algolia and building this new directly in Typesense. The hooks that I see that I potentially could use is useRefinementList (Didn't work), UseGeoSearch(Exploring this), and the one you mentioned UseConfigure. In UseConfigure I'm reading the use case is to add default filters to your index, so is it possible to keep changing the filter applied via the configure widget? not sure about that part.
j
so is it possible to keep changing the filter applied via the configure widget
Ah hmm, yeah I don't think the
configure
widget persists settings
UseGeoSearch
sounds promising
a
useGeoSearch is the one the gets me closest to the functionality I wanted but in a round about way. Refinement and Configure were not working well with geopoint fields. Thanks for looking into it!
👍 1
j
Good to know!