Skip to content

Surface per-search multi_search errors #37

Closed

Description

@edalzell

Typesense can return HTTP 200 from /multi_search while an individual result is an error:

{"code": 400, "error": "Could not find a filter field named ..."}

Index::searchUsingApi() assumes that result always contains hits and calls count($searchResults['hits']). The useful Typesense error is therefore replaced by Undefined array key \"hits\".

Validate the individual result before reading hits. When it contains code/error, throw a TypesenseClientError carrying the original message and status. Add a regression test with a mocked multi-search response so it does not require a live Typesense server.

Found via transformstudios/zakat.org#2309. Parent review: transformstudios/zakat.org#2374.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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