refactor(hunspell): rename package terminology to generic ref_path#21516
refactor(hunspell): rename package terminology to generic ref_path#21516shayush622 wants to merge 1 commit intoopensearch-project:mainfrom
Conversation
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 671475a.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
85e1b05 to
387c944
Compare
PR Reviewer Guide 🔍(Review updated until commit 671475a)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 671475a
Previous suggestionsSuggestions up to commit 387c944
|
|
❌ Gradle check result for 387c944: null 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? |
Rename HunspellService and HunspellTokenFilterFactory APIs from
package-specific naming to generic ref_path terminology:
- getDictionaryFromPackage -> getDictionaryFromRefPath
- loadDictionaryFromPackage -> loadDictionaryFromRefPath
- buildPackageCacheKey -> buildRefPathCacheKey
- Split validatePackageIdentifier into validateRefPath (allows /)
and validateLocale (allows dots)
- Extract CACHE_KEY_SEPARATOR constant
- Update all javadoc, comments, and test names
No behavioral change for existing functionality.
Signed-off-by: shayush622 <ayush5267@gmail.com>
387c944 to
671475a
Compare
|
Persistent review updated to latest commit 671475a |
|
The changes LGTM. I had the same 2 comments as the top on #21516 (comment), but these are fairly minor. |
Description
Renames package-specific terminology in the hunspell dictionary loading API to generic ref_path terminology, and splits the single input validator into type-specific validators with appropriate character
allowlists.
Motivation: The original API was named around "packages" (getDictionaryFromPackage, buildPackageCacheKey, validatePackageIdentifier) but the feature is a generic directory-based dictionary loading mechanism.
This rename makes the API self-documenting and prepares for follow-up work that allows nested paths (e.g., analyzers/my-dict).
Changes
HunspellService.java — renames getDictionaryFromPackage → getDictionaryFromRefPath, loadDictionaryFromPackage → loadDictionaryFromRefPath, buildPackageCacheKey → buildRefPathCacheKey; extracts
CACHE_KEY_SEPARATOR constant; updates path resolution to config/{ref_path}/hunspell/{locale}/; updates all javadoc and comments
HunspellTokenFilterFactory.java — splits validatePackageIdentifier into validateRefPath (allows / for nested paths) and validateLocale (allows dots, disallows /); adds validateAgainstPattern helper with
per-param error messages; updates call sites and comments
HunspellServiceTests.java — renames all test methods from Package to RefPath terminology; updates API calls and assertions
HunspellTokenFilterFactoryTests.java — renames validator tests; updates API calls to use validateRefPath/validateLocale
No behavioral change for existing functionality. All 43 tests pass.
Related
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
(https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).