-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose result or errors on search #6
Comments
Damn you're right, I assumed the Typesense client would raise for these, I'll add that 👍 |
Hmm, looking closer, it seems the Typesense client is supposed to raise for these (in fact, we even test that behavior on loading a collection!) I was unable to reproduce on the single-search endpoint, but I was able to reproduce with a multi-search like so: client.collections.create(
name: 'test',
fields: [{ name: 'foo', type: 'string' }]
)
# Do an invalid multi search
client.multi_search.perform({ searches: [{ collection: 'test', q: 'query', query_by: 'bar' }] })
# => {"results"=>[{"code"=>404, "error"=>"Could not find a field named `bar` in the schema."}]} This sorta makes sense, given that it allows you to return a partial result set, but you seem to be using the single-search endpoint, so I'm not sure why you're not getting an Exception 🤔 If you can get a reproducible example with the latest Typesense gem and an unmodified Typesensual, let me know and I can send it upstream for them to fix. It could also be a version of Typesense itself which fails to return the right HTTP status code, tbh. All that being said, there's no reason Typesensual can't provide a better API for this. I've got an idea to structure the response as |
Just released 1.0.0 with the change to how multi-search handles exceptions |
Hi there!
Would be nice to have request failures exposed, for instance:
I had to workaround that with:
The text was updated successfully, but these errors were encountered: