Feat/hunspell ref path#20792
Conversation
- Add INDEX_REF_PATH_SETTING for package-based hunspell dictionaries - Add RestHunspellCacheInvalidateAction for cache invalidation endpoint - Update HunspellService with cache management methods - Add ref_path validation in MetadataCreateIndexService Signed-off-by: shayush622 <ayush5267@gmail.com>
- Add ref_path parameter to hunspell token filter for package-based dictionaries
- Load dictionaries from config/packages/{packageId}/hunspell/{locale}/
- Add cache invalidation REST API endpoints:
- GET /_hunspell/cache (view cached dictionaries)
- POST /_hunspell/cache/_invalidate (invalidate by package_id, locale, or cache_key)
- POST /_hunspell/cache/_invalidate_all (clear all cached dictionaries)
- Add TransportAction with cluster:admin/hunspell/cache/clear permission
- Add path traversal security validation for packageId and locale
- Add updateable flag support for hot-reload via _reload_search_analyzers
- Add comprehensive test coverage for HunspellTokenFilterFactory and REST endpoint
- Remove unused index-level ref_path setting
Addresses PR feedback:
- Removed mise.toml from commit (local dev config)
- Added TransportAction authorization pattern
- Added 21 unit tests for REST endpoint
- Fixed security validation for path traversal attacks
- Documented race condition in invalidateAllDictionaries
Signed-off-by: shayush622 <ayush5267@gmail.com>
- Add ref_path parameter for package-based dictionary loading
- Load from config/packages/{packageId}/hunspell/{locale}/
- Add cache invalidation REST API (GET/POST /_hunspell/cache/_invalidate)
- Add TransportAction with cluster:admin permission
- Add comprehensive security validation (path traversal, separators, cache-key injection)
- Add updateable flag for hot-reload via _reload_search_analyzers
- Add comprehensive test coverage
PR feedback addressed:
- Stricter validate() to reject conflicting params
- Path traversal checks now use config/packages/ as base
- ref_path/locale validation rejects ., .., /, \, : characters
Signed-off-by: shayush622 <ayush5267@gmail.com>
Signed-off-by: shayush622 <ayush5267@gmail.com>
- Add ref_path parameter for package-based dictionary loading
- Load from config/packages/{packageId}/hunspell/{locale}/
- Add cache info API: GET /_hunspell/cache (cluster:monitor/hunspell/cache)
- Add cache invalidation API: POST /_hunspell/cache/_invalidate (cluster:admin/hunspell/cache/invalidate)
- Support invalidation by package_id, locale, cache_key, or invalidate_all
- Add security validation (path traversal, separator injection, null bytes)
- Add updateable flag for hot-reload via _reload_search_analyzers
- Use Strings.hasText() and Strings.isNullOrEmpty() for validation consistency
- Consistent response schema with all fields always present
- Add unit tests, REST handler tests, and integration tests
Signed-off-by: shayush622 <ayush5267@gmail.com>
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 3917262. 'Diff too large, requires skip by maintainers after manual review' Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
PR Reviewer Guide 🔍(Review updated until commit 385793b)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 385793b Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 190bfd1
Suggestions up to commit dbc150a
Suggestions up to commit 33f4a54
Suggestions up to commit 3917262
|
|
Persistent review updated to latest commit 33f4a54 |
|
❌ Gradle check result for 33f4a54: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
33f4a54 to
dbc150a
Compare
|
Persistent review updated to latest commit dbc150a |
|
❌ Gradle check result for dbc150a: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Not sure if its related to the changes in this PR, but this is showing backwards compatibility failures: |
|
❌ Gradle check result for dbc150a: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
- Add ref_path parameter for package-based dictionary loading
- Load from config/packages/{packageId}/hunspell/{locale}/
- Add cache info API: GET /_hunspell/cache (cluster:monitor/hunspell/cache)
- Add cache invalidation API: POST /_hunspell/cache/_invalidate (cluster:admin/hunspell/cache/invalidate)
- Support invalidation by package_id, locale, cache_key, or invalidate_all
- Add security validation (path traversal, separator injection, null bytes)
- Add updateable flag for hot-reload via _reload_search_analyzers
- Use Strings.hasText() and Strings.isNullOrEmpty() for validation consistency
- Consistent response schema with all fields always present
- Add unit tests, REST handler tests, and integration tests
Signed-off-by: shayush622 <ayush5267@gmail.com>
dbc150a to
190bfd1
Compare
|
Persistent review updated to latest commit 190bfd1 |
|
❌ Gradle check result for 190bfd1: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
- Add ref_path parameter for package-based dictionary loading
- Load from config/packages/{packageId}/hunspell/{locale}/
- Add cache info API: GET /_hunspell/cache (cluster:monitor/hunspell/cache)
- Add cache invalidation API: POST /_hunspell/cache/_invalidate (cluster:admin/hunspell/cache/invalidate)
- Support invalidation by package_id, locale, cache_key, or invalidate_all
- Add security validation (path traversal, separator injection, null bytes)
- Add updateable flag for hot-reload via _reload_search_analyzers
- Use Strings.hasText() and Strings.isNullOrEmpty() for validation consistency
- Consistent response schema with all fields always present
- Add unit tests, REST handler tests, and integration tests
Signed-off-by: shayush622 <ayush5267@gmail.com>
190bfd1 to
385793b
Compare
|
Persistent review updated to latest commit 385793b |
|
❌ Gradle check result for 385793b: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #20792 +/- ##
============================================
- Coverage 73.31% 73.27% -0.05%
- Complexity 72248 72308 +60
============================================
Files 5795 5804 +9
Lines 330044 330395 +351
Branches 47641 47696 +55
============================================
+ Hits 241975 242092 +117
- Misses 68609 68853 +244
+ Partials 19460 19450 -10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This PR adds support for loading Hunspell dictionaries from package-based directories using a new ref_path parameter, enabling multi-tenant dictionary isolation and hot-reload capabilities.
Related Issues
Resolves #[20712]
Link to #20712 (comment).
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.