test(search): add non-English language coverage for FT.SEARCH#3339
Merged
nkaradzhov merged 2 commits intoJul 21, 2026
Conversation
Add integration tests exercising RediSearch stemming and tokenization for languages other than English. The LANGUAGE / LANGUAGE_FIELD options already had argument-encoding tests, but no test covered the actual search behavior against a live server. Covers: - language-specific stemming (German, French, Spanish, Greek, Indonesian) - query-time LANGUAGE option - Chinese tokenization via the friso tokenizer - per-document LANGUAGE_FIELD routing Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nkaradzhov
marked this pull request as ready for review
July 14, 2026 11:53
PavelPashov
approved these changes
Jul 17, 2026
| { language: REDISEARCH_LANGUAGE.FRENCH, text: 'Les chevaux courent vite', query: 'cheval' }, | ||
| { language: REDISEARCH_LANGUAGE.SPANISH, text: 'Nosotros hablamos mucho', query: 'hablar' }, | ||
| { language: REDISEARCH_LANGUAGE.GREEK, text: 'Οι άνθρωποι περπατούν', query: 'άνθρωπος' }, | ||
| // Indonesian stemmer reduces "membaca" to the root "baca" (since 8.9.0) |
Contributor
There was a problem hiding this comment.
This should be since 8.10.0?
|
|
||
| testUtils.testWithClient('per-document LANGUAGE_FIELD', async client => { | ||
| await client.ft.create('idx', { content: SCHEMA_FIELD_TYPE.TEXT }, { | ||
| LANGUAGE_FIELD: '__lang' |
Contributor
There was a problem hiding this comment.
Should we broaden the LANGUAGE_FIELD TypeScript type to accept plain hash field names such as __lang? It currently requires @ or $., but Redis defines LANGUAGE_FIELD as a document attribute in the FT.CREATE documentation.
…E_FIELD FT.CREATE defines LANGUAGE_FIELD and SCORE_FIELD as document attributes, which for hash indexes are plain field names (e.g. __lang). The previous RediSearchProperty type required an @ or $. prefix, rejecting valid input at compile time. Widen both options to also accept any string while keeping autocomplete for the prefixed forms. Also drop the incorrect "since 8.9.0" note on the Indonesian stemming test case: the Indonesian stemmer has been available since the libstemmer 2.0 upgrade in RediSearch 2.0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PavelPashov
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request adds integration tests covering RediSearch behavior for languages other than English. The
LANGUAGEandLANGUAGE_FIELDoptions onFT.CREATE/FT.SEARCHalready had argument-encoding tests, but no test exercised the actual stemming/tokenization behavior against a live server.The new
non-English languagesblock inSEARCH.spec.tsverifies:LANGUAGE— the explicit query-side language option is accepted and yields the expected match.frisotokenizer segments un-spaced text so a sub-term matches, whereas the default tokenizer does not.LANGUAGE_FIELD— documents are stemmed according to their own language field, so a German query and a French query each match only their respective document.Test-only change; no runtime behavior is affected. Runs on the default 8.10 test image (Indonesian stemmer requires 8.9.0+).
🤖 Generated with Claude Code
Note
Low Risk
Scope is integration tests plus widened TypeScript types for create options; runtime command behavior is unchanged.
Overview
Adds live-server integration tests for non-English RediSearch behavior and tightens FT.CREATE typings so hash field names work for language/score metadata.
The new
non-English languagesblock inSEARCH.spec.tschecks that language-specific Snowball stemming matches inflected text (German, French, Spanish, Greek, Indonesian) while an English index over the same doc does not, that query-timeLANGUAGEbehaves the same, that Chinese tokenization matches a sub-term in unsegmented text, and thatLANGUAGE_FIELD(__lang) stems each document with its own language.In
CREATE.ts, introducesRediSearchAttributeand uses it forLANGUAGE_FIELDandSCORE_FIELDso plain hash fields (e.g.__lang) type-check alongside@/$.properties—no command encoding changes.Reviewed by Cursor Bugbot for commit 64354ca. Bugbot is set up for automated code reviews on this repo. Configure here.