typesense / typesense/typesense

Add `exact_match` option to schema's field parameters

Open
#1,930 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
26.6k
Forks
973
Avg merge
18h 45m
Merged PRs (30d)
4

Description

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:

  1. Set a field of type string[] in your schema, such as sizes.
  2. Insert documents with values like ["11.5", "12", "4.5"] for the sizes field.
  3. Try filtering using the sizes field with the value 45.

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.

image (3)

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the string[] sizes case described in the issue, then trace schema field definitions into the filtering operations that handle field parameters. Done means an exact_match option can be enabled for an individual field and filtering for 45 excludes values such as 4.5 without changing other fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.