OR
fix: search with `exact: true`
oramasearch/orama#941

๐Ÿ”— Linked Issue

Closes #866

โ“ Type of Change

  • ๐Ÿ“– Documentation (updates to docs or README)
  • ๐Ÿž Bug fix (non-breaking change that fixes an issue)
  • ๐Ÿ‘Œ Enhancement (improves existing functionality)
  • โœจ New feature (non-breaking change that adds functionality)
  • ๐Ÿงน Chore (build process or auxiliary tooling)
  • โš ๏ธ Breaking change (fix or feature that changes existing behaviour)

๐Ÿ“š Description

With exact: true, the search currently returns documents whose terms partially match the query instead of only those with an exact match.

Why it happens

  1. The search code first tokenises the term.
  2. For each token, it then checks the radix tree for that same token.

Unfortunetly, neither filters nor facets allow a strict equality between a property value and the full term. Below my proposal.

๐Ÿ› ๏ธ Proposed Solution

  1. Keep the current token-level matching.
  2. Rename the internal exact flag to something explicit (e.g. exactToken; open to suggestions).
  3. Apply the public exact option only when comparing the entire property value to the entire normalised term. (like implemented in this PR)

โœ… Status

  • Implementation complete
  • Tests updated
  • Documentation updated

@algora-pbc /claim #866

Claim

Total prize pool $150
Total paid $0
Status Pending
Submitted May 20, 2025
Last updated May 20, 2025

Contributors

VA

Valentin Chmara

@vachmara

100%

Sponsors

OR

OramaSearch

@oramasearch

$150