Skip to content

Typing for geo_distance_meters is too strict #348

@steffen-baumann-procureai

Description

Issue Statement

The typing at https://github.com/typesense/typesense-js/blob/master/lib/Typesense/Documents.d.ts#L71 is too strict on location. The actual field name depends on the actual collection definition.

Expected Behavior

Either the typing is more lenient allowing [k:string|: number or some generic parameterization is provided to dynamically define the actual geo_distance_meters property name.

Reproduction Scenario

We have a collection with defined with:

name: coordinates
type: geopoint
facet: false
index: true
infix: false
optional: true
sort: true
stem: false
store: true

As a result, our filtering and sorting requires to go by:

"filter_by": "coordinates:(59.1, 9.2, 100km)"
"sort_by": "coordinates(59.1, 9.2):asc"

And this finally creates outputs defining the geo_distance_meters on hits as:

"geo_distance_meters": {
  "coordinates": 95432
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions