feat(synonyms): add support for V30 synonyms #311
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TLDR
Introduce Synonym Sets support in the Typesense client with full API integration, test coverage, and example usage.
Changes
Added Features:
Client Support for Synonym Sets (
Client.ts
):synonymSets()
method added to theClient
class with overloads for retrieving all sets or accessing individual sets by name._synonymSets
andindividualSynonymSets
for caching and reuse.Synonym Set Management Classes:
SynonymSet.ts
: DefinesSynonymSet
class to handle upsert, retrieve, and delete operations for a specific synonym set.SynonymSets.ts
: Manages operations for all synonym sets collectively.Collection Schema (
Collection.ts
,Collections.ts
,Types.ts
):synonym_sets
array.synonym_sets
is also supported in search parameters for more refined query behavior.Version Detection Utility (
utils.ts
):isV30OrAbove()
function added to dynamically skip tests based on Typesense version (supports both nightly and stable v30+ builds).Test Coverage:
New Test Suite for Synonym Sets (
SynonymSets.spec.ts
):Conditional Skipping for Existing Tests:
describe.skipIf(await isV30OrAbove(...))
to conditionally skip based on version compatibility.Test Refactoring:
describe()
blocks to reduce duplication.Documentation Updates:
synonymSets.ts
):PR Checklist