Typesense range filter returns wrong results when filter_by is not URL-encoded

Filtering documents by a numeric field with duration:<=1200 worked, but adding a second condition (duration:>=600 && duration:<=1200) returned more results than the single condition, which is impossible for a correct AND. The >=, &&, and space characters in the filter_by parameter were not URL-encoded, so Typesense parsed a mangled filter. A reproduction in the Go client showed the same: the test only passed once the filter string was URL-encoded.

URL-encode the filter_by parameter. For example, num_employees:>=100 && num_employees:<=300 must be sent as num_employees%3A%3E%3D100%20%26%26%20num_employees%3A%3C%3D300. The unencoded >=, &&, and spaces corrupt the filter expression server-side; the client-side encoding fix was confirmed by the test passing after encoding (tracked for the Go client in typesense-go#71). Source: https://github.com/typesense/typesense/issues/210

Source: https://github.com/typesense/typesense/issues/210