Geosearch Formatting Issue using Angular-InstantSearch
TLDR Kenneth was having trouble with geosearch formatting using Angular-InstantSearch. Jason suggested using ais-configure
widget and aroundLatLng
and aroundRadius
parameters, which solved the problem. Additionally, Jason provided guidance on configuring the geopoint field.


Feb 15, 2022 (19 months ago)
Kenneth
08:56 PMSubmitting this (using Angular-InstantSearch widgets):
searchParameters = {
hitsPerPage: 10,
q : '*',
query_by : 'title',
facetFilters: ['locationCoordinates: (44.3387557, -79.6795558, 1000.1km)'],
}
And getting this:
Value of filter field
location: must be in the
(-44.50, 170.29, 0.75 km) or (56.33, -65.97, 23.82, -127.82) format.
I get this error while using instantsearch-adapter. Other search parameters work just fine (ex. hitsPerPage)
Hitting the server with curl requests yields either the same error or 'bad request'. Fields are set as facets, and I've tried every possible combination of quotes, backticks, brackets, spaces, decimal points, etc I can think of.
PS. feel free to hit me with Angular related Typesense questions 🙂
Jason
09:41 PM
Kenneth
10:22 PMThe only issue I had was figuring out how to specify the name of the field to a value other than '_geoloc'. For now I simply made by schema use the field name ais expects ("_geoloc").
For future inquiries, here is what I ended up doing:
schema:
myCollection = {
'name': `${snapshot.id}`,
'fields': [
{"name": ".*", "type": "auto"},
{'name': '_geoloc', 'type': 'geopoint', 'facet': true},
{'name': 'category.lvl0', 'type': 'string', 'facet': true},
{'name': 'category.lvl1', 'type': 'string',
"optional": true, 'facet': true},
],
} as CollectionCreateSchema;
component.ts
// region Typesense Configuration
config = {
indexName: 'events',
searchClient
} as InstantSearchConfig;
searchParameters = {
hitsPerPage: 10,
q : '*',
query_by : 'title',
aroundLatLng: '45.406431, -78.6848739',
aroundRadius: 1000
}
// endregion
component.html
<ais-instantsearch [config]="config" (change)="setHits($event)">
<ais-configure
[searchParameters]="searchParameters"
></ais-configure>
<ais-search-box [searchAsYouType]="false"></ais-search-box>
<ais-geo-search></ais-geo-search>
<ais-hits>
<ng-template #searchResults let-hits="hits" let-results="results">
<div *ngFor="let hit of hits">
{{hit.title}}
<button (click)="likeEvent(hit.eventId)">Like</button>
</div>
</ng-template>
</ais-hits>
</ais-instantsearch>
Jason
11:02 PMKenneth
11:43 PM
Typesense
Indexed 2764 threads (79% resolved)
Similar Threads
Troubleshooting Typesense Setup and Understanding Facets and Keywords
Demitri encountered errors when exploring Typesense for the first time. Jason guided them through troubleshooting and discussed facets, keyword settings, and widget configurations. Helin shared a Python demo app and its source code to help Demitri with their project.

Fixing Multiple Document Retrieval in Typesense
Phil needed an efficient way to retrieve multiple documents by id. Kishore Nallan proposed a solution available in a pre-release build. After some bug fixing regarding id matching by Jason and Kishore Nallan, Phil successfully tested the solution.



Troubleshooting Issues with DocSearch Hits and Scraper Configuration
Rubai encountered issues with search result priorities and ellipsis. Jason helped debug the issue and suggested using different versions of typesense-docsearch.js, updating initialization parameters, and running the scraper on a Linux-based environment. The issues related to hits structure and scraper configuration were resolved.


