typesense / typesense-js

JavaScript / TypeScript client for Typesense
https://typesense.org/docs/api
Apache License 2.0
414 stars 75 forks source link

Filter_by does not accept brackets #155

Closed ivanbacher closed 1 year ago

ivanbacher commented 1 year ago

Description

Filtering by institution names. One of the names has brackets. But getting this

RequestMalformed: Request failed with HTTP code 400 | Server said: Could not parse the filter query.
filter_by: "institution.name:=Hagias Monastery (Zoodochos Pigi)"

/search?q=*&query_by=gaNumber&per_page=20&page=1&group_by=&filter_by=institution.name:%3DHagias+Monastery+(Zoodochos+Pigi)

I am assuming it's because of the brackets as all other queries work.

Steps to reproduce

Expected Behavior

Return query results

Actual Behavior

RequestMalformed: Request failed with HTTP code 400 | Server said: Could not parse the filter query.

Metadata

Typesense Version: 0.24 (docker)

OS:

jasonbosco commented 1 year ago

You want to escape the string with backquotes like this:

filter_by: "institution.name:=`Hagias Monastery (Zoodochos Pigi)`"
ivanbacher commented 1 year ago

Ah super, thank you.