orama icon indicating copy to clipboard operation
orama copied to clipboard

fix: search with `exact: true`

Open vachmara opened this issue 8 months ago โ€ข 1 comments

๐Ÿ”— Linked Issue

Closes #866

โ“ Type of Change

  • [ ] ๐Ÿ“– Documentation (updates to docs or README)
  • [x] ๐Ÿž Bug fix (non-breaking change that fixes an issue)
  • [x] ๐Ÿ‘Œ 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

  • [x] Implementation complete
  • [x] Tests updated
  • [ ] Documentation updated

@algora-pbc /claim #866

vachmara avatar May 20 '25 15:05 vachmara

@vachmara is attempting to deploy a commit to the OramaSearch Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 20 '25 15:05 vercel[bot]

Killyou

padagab12345 avatar Sep 04 '25 22:09 padagab12345

Chu l

padagab12345 avatar Sep 04 '25 22:09 padagab12345

chill out or gtfo @padagab12345

micheleriva avatar Sep 04 '25 22:09 micheleriva