Add `exact_match` option to schema's field parameters
Description:
Currently, the only way to achieve exact string matching in Typesense is by adding characters to symbols_to_index. However, this approach applies to all fields in the collection, which may not always be desirable.
Steps to Reproduce:
- Set a field of type
string[]in your schema, such assizes. - Insert documents with values like
["11.5", "12", "4.5"]for thesizesfield. - Try filtering using the
sizesfield with the value45.
Expected Behavior:
The filter should return documents that exactly match the value 45. No documents containing 4.5 should be included in the results.
Actual Behavior:
The filter returns documents that include 4.5, despite not being an exact match to 45.
Proposed Solution:
Introduce an exact_match parameter to field definitions within the schema. When set to true, this parameter should enforce exact matching for the field during filtering operations.
Metadata:
- Typesense Version: v27.0
- OS: Cloud
Also, I've noticed that the matching is case insensitive:
Looking at the docs (https://typesense.org/docs/27.0/api/search.html#filter-parameters):
"Exact vs Non-Exact Filtering: To match a string field's full value verbatim, you can use the := (exact match) operator. For eg: category := Shoe will match documents with category set as Shoe and not documents with a category field set as Shoe Rack."
This is kind of misleading, since filtering by shoe will match all of shoe, Shoe and SHOE