When querying my Typesense collection with a speci...
# community-help
j
When querying my Typesense collection with a special character (e.g.
@
), I seem to get all results back when I'd actually expect no results (none of my documents contain an
@
). Is there an option to disable this behaviour? We depend on there being some highlight information in the results, but when searching for special characters we don't get any highlight data back (as the result doesn't actually match the query).
j
By default, Typesense removes special characters from the search query. So
q=@
will actually translate to
q=*
by default. You want to add
@
to the
symbols_to_index
setting when creating the collection, to change this behavior
j
Ah right. I don't think I want to add
@
to
symbols_to_index
as none of my results have
@
in them (and I'd have to do it for every other special character too!) - ideally if a query consists entirely of non-indexed symbols then it should return nothing, but I understand treating it as
*
. I'll implement something on our client-side to not send a query if it only consists of special characters.
You wouldn't happen to know where in the Typesense code it strips symbols from the query would you? Ideally I'd like to implement the same logic on our client.