Skip to content

fix: search with exact: true #941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

vachmara
Copy link

πŸ”— 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

Copy link

vercel bot commented May 20, 2025

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

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search with exact: true doesn't work as intended
1 participant