orama
orama copied to clipboard
fix: search with `exact: true`
๐ 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
- The search code first tokenises the
term. - 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
- Keep the current token-level matching.
- Rename the internal
exactflag to something explicit (e.g.exactToken; open to suggestions). - Apply the public
exactoption 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 is attempting to deploy a commit to the OramaSearch Team on Vercel.
A member of the Team first needs to authorize it.
Killyou
Chu l
chill out or gtfo @padagab12345