Skip to content

[8.0] MOD-8799: Support special utf8#6328

Merged
oshadmi merged 1 commit into8.0from
backport-5637-to-8.0
Jun 17, 2025
Merged

[8.0] MOD-8799: Support special utf8#6328
oshadmi merged 1 commit into8.0from
backport-5637-to-8.0

Conversation

@redisearch-backport-pull-request
Copy link
Contributor

Description

Backport of #5637 to 8.0.

* Normalize multi-byte char terms

* Fix rm_strdupcase_utf8

* Remove debug log

* Add Russian alphabet and diacritic tests

* Don't use DefaultNormalize_utf8() for chinese

* print available locales

* Check locale before using utf8 normalization

* Fix DefaultNormalize()

* Skip multibyte tests if 'en_US.UTF-8' locale is not available

* Test multibyte stopwords

* Revert changes in install_script.sh

* run sanitizer using ubuntu:latest

* Test_cn: fix language_field

* Remove unused strtolower function from misc.c and misc.h

* Fixes from code review

* Enhance multibyte character tests

* Validate queries using multi-byte stopwords

* Add MULTIBYTE_CHARS config param and install locales

* Use setlocale instead of querylocale for better compatibility

* revert changes in event-pull_request.yml and install French locale for debian/ubuntu

* Convert to lowercase using nunicode library

* nunicode_tolower() returns zero terminated string

* Refactor nunicode_tolower() to improve readability

* Refactor nunicode_tolower() to use destination buffer and improve memory management

* Remove null termination in nunicode_tolower()

* Improve documentation

* Support multi-byte chars for tags

* Support multi-byte chars for synonyms

* unicode_tolower(): avoid duplicating encoded input

* Increase SSO_MAX_LENGTH

* Update test to  use FT.DEBUG DUMP_TAGIDX instead of FT.TAGVALS

* Keep previous test_cn:testSynonym and test_cn:testMixedHighlight

* Update CMake configuration for consistent multi-byte char sorting

* Test JSON index

* Fix JSON test and remove unneeded tolower()

* Fix query_EvalSingleTagNode()

* Refactor string normalization to use case folding instead of lowercase conversion

* Refactor tests to use run_command_on_all_shards for setting DEFAULT_DIALECT

* BWC: Add function to convert string to single codepoint folded runes

* Rename rm_strdupcase() to rm_normalize()

* Add stemming test

* Refactor string normalization to use lowercase transformation instead of folding.
Modify FT.SUGGET flow to be BWC

* Refactor filtering functions to use a transformation callback for rune processing. Remove dead code.

* Update testDFAFilter to use strToSingleCodepointFoldedRunes for rune processing

* Refactor string normalization to use case folding (single codepoint) instead of lowercase transformation

* Revert "Refactor string normalization to use case folding (single codepoint) instead of lowercase transformation"

This reverts commit ebcf994.

* Add case sensitivity option to tag string processing functions

* Rename tag_strtofold to tag_strtolower for clarity and update related references to reflect lowercase transformation

* Simplify length checks in tag_strtolower and rm_normalize functions

* Add documentation after review

* WIP: Enhance unicode_tolower function to handle memory allocation for transformed strings

* WIP: Fixing unicode_tolower usage

* Fix tag_strtolower() to support memory realloc

* skip testToLowerSize() on cluster

* Fix rm_normalize and add more tests

* Fix memory leak

* Fix memory leak 2

* MOD-9609: Pass Private Data Context Back To UnblockClient API (#6237)

* Apparently private data had to be sent back when unblocking the client in order for the free function to get called

* code review comment

* solve memory leak

* MOD-9774: Stop Compiling Redis-With Coverage (#6231)

* stop compiling redis-server with coverage

* bring back coverage as requirement

* Add unit test for unicode_tolower

* Fix memory management in UnicodeToLowerTest and update expected results in multibyte character tests

* Add tests for unsupported Unicode characters in tolower conversion.

* MOD-9768: Add Rust abstractions for Buffer* (#6175)

* Add Rust abstractions for Buffer*

* Add tests

* Make Buffer fields pub

For consistency with BufferReader and BufferWriter. Also there is a very
good chance of us needing to use them directly in the near future.

* Expand the docs a bit more

* Add and improve upon safety comments

* fmt fix

* Add forgotten license headers

* Revert "Make Buffer fields pub"

This reverts commit 1243590.

* Address review comments

* Address review comments

* Better document safety of `Buffer` fields

* Apply suggestions from code review

Co-authored-by: Luca Palmieri <[email protected]>

* Remove an unneeded import

* Use reallocation in mock `Buffer_Grow`

* Satisfy MIRI about some pointer access

* Drop unneeded dep

* Remove unnecessary #includes

* Split FFI into a separate crate

* Add buffer.h API to ffi crate

* Buffer API now based on generated bindings for the C Buffer API

* CI: Set `CARGO_PROFILE_OPTIMISED_TEST_BUILD_OVERRIDE_DEBUG` env

Just acting on the advice from a panic:

```
To improve backtraces for build dependencies, set the CARGO_PROFILE_OPTIMISED_TEST_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.
```

* Drop linking of internal libs in ffi crate

* Apply suggestions from code review

Co-authored-by: Luca Palmieri <[email protected]>

* Revert "CI: Set `CARGO_PROFILE_OPTIMISED_TEST_BUILD_OVERRIDE_DEBUG` env"

This reverts commit 9bd1d87.

* Drop a redundant import

* Add a few debug_asserts

* Bring back an accidentally deleted assertion in a test

* Fix a .gitignore file

* Make a safety assumption explicit

* Dont build `buffer` crate as static lib

* Don't build bindings for oxidized triemap code

* Make use of BufferWritter::buffer_mut

* Fix build on Alpine

---------

Co-authored-by: Luca Palmieri <[email protected]>

* refactor EmptyIterator (#6240)

* refactor EmptyIterator

* fix useless imports and doc

* update empty_iterator.c to add newline

* add gcc11:bullseye to platforms [MOD-9529] (#6198)

* add gcc11:bullseye to platforms

* add naming

* remove deps

* add nightly platforms option

* set merge queue to false

* fix flow

* fix flow

* chore: Improve granularity of build invalidation logic for FFI bindings (#6244)

* Add `tests/deps/RedisJSON` to `.gitignore` (#6249)

* Skip tests of unsupported unicode 9.0.0 chars

* Fix mem leak 3

* Test stopwords which require memory reallocation

* unicode_tolower update out_len always

* Refactor unicode_tolower function to receive a single  *inout_len argument

* Update documentation for tag_strtolower()

* Fixes after review

* tokenizeTagString: Rename origLen as len

* Test prefix/infix/suffix search with supported unicode chars

* Update test description

* Fix testToLowerConversionExactMatch

* testTextToLowerConversionSimilarMatch: remove unused doc_id in queries

* fix crash in test

* Fix test failure on focal and bullseye: avoid nested f-strings with curly brackets

* Fix test failure on mac: invalid escape sequence

* Use SSO in runesToStr and strToLowerRunes

* Add utf8_len arg to strToLowerRunes()

* Align and move strToLowerRunes comment to header

---------

Co-authored-by: kei-nan <[email protected]>
Co-authored-by: Zeeshan Ali Khan <[email protected]>
Co-authored-by: Luca Palmieri <[email protected]>
Co-authored-by: Joan Fontanals <[email protected]>
Co-authored-by: BenGoldberger <[email protected]>
Co-authored-by: oshadmi <[email protected]>
(cherry picked from commit dfe511e)
@codecov
Copy link

codecov bot commented Jun 16, 2025

Codecov Report

Attention: Patch coverage is 91.59664% with 10 lines in your changes missing coverage. Please review.

Project coverage is 88.80%. Comparing base (bf43119) to head (ef4747f).
Report is 1 commits behind head on 8.0.

Files with missing lines Patch % Lines
src/trie/rune_util.c 84.00% 4 Missing ⚠️
src/stopwords.c 83.33% 2 Missing ⚠️
src/tag_index.c 81.81% 2 Missing ⚠️
src/tokenize.c 90.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              8.0    #6328      +/-   ##
==========================================
- Coverage   88.87%   88.80%   -0.07%     
==========================================
  Files         201      201              
  Lines       37365    37413      +48     
==========================================
+ Hits        33207    33226      +19     
- Misses       4158     4187      +29     
Flag Coverage Δ
flow 83.28% <88.23%> (-0.18%) ⬇️
unit 42.31% <72.26%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fcostaoliveira
Copy link
Contributor

fcostaoliveira commented Jun 16, 2025

Automated performance analysis summary

This comment was automatically generated given there is performance data available.

In summary:

  • Detected a total of 22 stable tests between versions.
  • Detected a total of 6 highly unstable benchmarks.
  • Detected a total of 8 improvements above the improvement water line.
  • Detected a total of 4 regressions bellow the regression water line 5.0.

You can check a comparison in detail via the grafana link

Comparison between 8.0 and backport-5637-to-8.0.

Time Period from 30 days ago. (environment used: oss-standalone)

Test Case Baseline 8.0 (median obs. +- std.dev) Comparison backport-5637-to-8.0 (median obs. +- std.dev) % change (higher-better) Note
ftsb-10K-enwiki_abstract-hashes-fulltext-sortby 83 +- 3.8% (7 datapoints) 83.00 0.5% No Change
ftsb-10K-enwiki_abstract-hashes-term-prefix 8880 +- 5.8% (7 datapoints) 9626.00 8.4% waterline=5.8%. IMPROVEMENT
ftsb-10K-enwiki_abstract-hashes-term-suffix 2701 +- 1.0% (7 datapoints) 2737.00 1.4% No Change
ftsb-10K-enwiki_abstract-hashes-term-suffix-withsuffixtrie 78335 +- 2.4% (7 datapoints) 78263.00 -0.1% No Change
ftsb-10K-enwiki_abstract-hashes-term-wildcard 14275 +- 8.1% (7 datapoints) 16030.00 12.3% waterline=8.1%. IMPROVEMENT
ftsb-10K-enwiki_pages-hashes-fulltext-mixed_simple-1word-query_write_1_to_read_20.yml 1138 +- 6.2% (7 datapoints) 1187.00 4.3% waterline=6.2%. potential IMPROVEMENT
ftsb-10K-enwiki_pages-hashes-load 59237 +- 2.8% (7 datapoints) 67342.00 13.7% IMPROVEMENT
ftsb-10K-multivalue-numeric-json 1031 +- 1.6% (7 datapoints) 1037.00 0.6% No Change
ftsb-10K-singlevalue-numeric-json 461 +- 1.2% (7 datapoints) 471.00 2.2% No Change
ftsb-1K-enwiki_abstract-hashes-term-contains 2262 +- 2.0% (7 datapoints) 2291.00 1.3% No Change
ftsb-1M-enwiki_abstract-hashes-fulltext-2word-intersection-query 328 +- 20.6% UNSTABLE (7 datapoints) 451.00 37.2% UNSTABLE (very high variance)
ftsb-1M-enwiki_abstract-hashes-fulltext-2word-intersection-query-non-sortable 28 +- 33.2% UNSTABLE (7 datapoints) 35.00 25.4% UNSTABLE (very high variance)
ftsb-1M-enwiki_abstract-hashes-fulltext-2word-union-query 3325 +- 9.2% (7 datapoints) 4009.00 20.6% waterline=9.2%. IMPROVEMENT
ftsb-1M-enwiki_abstract-hashes-fulltext-2word-union-query-non-sortable 1062 +- 3.7% (7 datapoints) 1111.00 4.6% potential IMPROVEMENT
ftsb-1M-enwiki_abstract-hashes-fulltext-simple-1word-query 801 +- 28.0% UNSTABLE (7 datapoints) 1181.00 47.5% UNSTABLE (very high variance)
ftsb-1M-enwiki_abstract-hashes-load 22241 +- 6.0% (7 datapoints) 23369.00 5.1% waterline=6.0%. potential IMPROVEMENT
ftsb-1M-nyc_taxis-ftadd-load 28741 +- 1.9% (7 datapoints) 30110.00 4.8% potential IMPROVEMENT
ftsb-1M-nyc_taxis-hashes-load 32415 +- 2.9% (7 datapoints) 31742.00 -2.1% No Change
search-aggregate-post-filter-simple.yml 110628 +- 5.0% (7 datapoints) 110560.00 -0.1% No Change
search-filtering-tag-numeric 281 +- 11.4% UNSTABLE (7 datapoints) 280.00 -0.2% UNSTABLE (very high variance)
search-filtering-tag-numeric-filter-pipeline 25446 +- 1.8% (7 datapoints) 24897.00 -2.2% No Change
search-ftsb-10K-enwiki_abstract-hashes-term-withoutsuffix-trie 51084 +- 2.7% (7 datapoints) 46868.00 -8.3% REGRESSION
search-ftsb-10K-enwiki_abstract-hashes-term-withsuffix-trie 49363 +- 3.9% (7 datapoints) 46949.00 -4.9% potential REGRESSION
search-ftsb-1700K-docs-union-iterators-q3 8.3 +- 1.1% (7 datapoints) 8.30 -0.4% No Change
search-ftsb-1M-enwiki_abstract-hashes-fulltext-simple-1word-query-non-sortable 148 +- 9.4% (7 datapoints) 161.00 8.5% waterline=9.4%. potential IMPROVEMENT
search-ftsb-370K-docs-union-iterators-q4 8.8 +- 0.9% (7 datapoints) 8.70 -1.5% No Change
search-ftsb-5200K-docs-union-iterators-q1 0.86 +- 1.6% (7 datapoints) 0.85 -1.2% No Change
search-ftsb-5500K-docs-union-iterators-q2 1.3 +- 2.1% (7 datapoints) 1.20 -4.7% potential REGRESSION
search-geo 222 +- 3.7% (7 datapoints) 217.00 -2.2% No Change
search-high-cardinality-negation-term-baseline 29 +- 4.5% (7 datapoints) 31.00 6.6% IMPROVEMENT
search-high-cardinality-negation-term-comparison_union_all_other_terms 8.6 +- 2.0% (7 datapoints) 9.10 5.8% IMPROVEMENT
search-numeric 3010 +- 8.5% (7 datapoints) 3364.00 11.8% waterline=8.5%. IMPROVEMENT
search-numeric-optimize 14433 +- 1.3% (7 datapoints) 14243.00 -1.3% No Change
search-numeric-sortby 5199 +- 25.6% UNSTABLE (7 datapoints) 3293.00 -36.7% UNSTABLE (very high variance)
search-numeric-sortby-desc 3117 +- 37.6% UNSTABLE (7 datapoints) 3131.00 0.4% UNSTABLE (very high variance)
search-numeric-sortby-desc-optimize 29 +- 8.4% (7 datapoints) 30.00 1.8% waterline=8.4%. No Change
search-numeric-sortby-optimize 26 +- 5.7% (7 datapoints) 30.00 14.4% waterline=5.7%. IMPROVEMENT
vecsim-arxiv-titles-384-angular-filters-m16-ef-128-fulltext-filter 642 +- 3.0% (7 datapoints) 500.00 -22.1% REGRESSION
vecsim-arxiv-titles-384-angular-filters-m16-ef-128-numeric-filter 165 +- 7.0% (7 datapoints) 117.00 -29.0% waterline=7.0%. REGRESSION
vecsim-arxiv-titles-384-angular-filters-m16-ef-128-tag-filter 77691 +- 4.5% (7 datapoints) 70866.00 -8.8% REGRESSION

@redisearch-backport-pull-request redisearch-backport-pull-request bot added this pull request to the merge queue Jun 16, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 16, 2025
@nafraf nafraf added this pull request to the merge queue Jun 16, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 16, 2025
@oshadmi oshadmi added this pull request to the merge queue Jun 17, 2025
Merged via the queue into 8.0 with commit 80345aa Jun 17, 2025
35 of 40 checks passed
@oshadmi oshadmi deleted the backport-5637-to-8.0 branch June 17, 2025 10:52
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.

3 participants