Skip to content

SearchResultHit.TextMatchInfo.NumTokenDropped type is incorrect #194

Open
typesense/typesense-api-spec
#89
@MarwanAlsoltany

Description

@MarwanAlsoltany

Description

I am performing a query with sort_by=_text_match:desc. The SDK is not able to unmarshal the response JSON. The error I am getting is the following:

json: cannot unmarshal number 18446744073709551602 into Go struct field .hits.text_match_info.num_tokens_dropped of type int

Here is a direct link to the line producing the issues:

NumTokensDropped *int `json:"num_tokens_dropped,omitempty"`

I changed the type to uint manually and everything seemed to be working as expected.

Now I know this is an automatically generated file, but is there really a reason why NumTokensDropped is typed as int and not uint, can this value ever be in negative? Or is it because the generator uses OpenAPI spec, which doesn't support unsigned integers?

BTW, I think other fields typed with int in this file could be changed to uint as well (e.g. BestFieldWeight).

Steps to reproduce

I am not sure why the num_token_dropped is this high, Not sure if it has to do with the dataset I am testing against or is it always int64.

Expected Behavior

Would expect it to complete the operation successfully.

Actual Behavior

Error due json.Unmarshal failing.

Metadata

Go Version: 1.22.4

Typesense Version: v27.1

Typesense SDK Version: v3.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions