Facet values with certain characters don't work
mschinis opened this issue Β· comments
Describe the bug π
I am currently using this library to build the requests sent to algolia, and noticed than when a value has a special character like &
it is not percent encoded, leading to an incorrect query and the request failing.
If I percent encode it myself, before passing it in the library, the library then, double percent encodes it, leading to 0 results.
Culprit
Expected behavior π
The library should percent encode, allowing only alpha numerics instead of url allowed
Hi @mschinis,
Could you give a concrete example of a parameter leading to failure?
I made a test of query with &
and the url encoding works as expected.
let query = Query().set(\.query, to: "request with &")
print(query.urlEncodedString) // query=request%20with%20%26
Hi @VladislavFitz,
Sure, the issue I'm having is for facet values. I should have mentioned that I'm also using InstantSearchCore for building these requests like so:
let queryBuilder = QueryBuilder(
query: "Ostrich wall lamp",
disjunctiveFacets: [
// ..
],
filterGroups: [
FilterGroup.And(
filters: [
FacetFilter(attribute: "manufacturer", stringValue: "&Quirky")
],
name: "manufacturer"
)
// ...
],
hierarchicalAttributes: [
// ..
],
hierachicalFilters: [
// ..
]
)
Executing the above query, results in the following:
After looking at this further, might be related to how InstantSearchCore is using AlgoliaSearchClient π€