-
Notifications
You must be signed in to change notification settings - Fork 100
feat: add search filters for deprecated packages and newly published ... #860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add search filters for deprecated packages and newly published ... #860
Conversation
...packages Implemented two new search filter configurations: 1. `searchExcludeDeprecated` - Filter deprecated packages from search results - Default: true (deprecated packages are excluded by default) - Can be disabled by setting to false - Controlled by env: CNPMCORE_CONFIG_SEARCH_EXCLUDE_DEPRECATED 2. `searchPackageMinAge` - Filter newly published packages - Default: empty string (no filter applied) - Supports time format: '2w' (weeks), '14d' (days), '336h' (hours) - Controlled by env: CNPMCORE_CONFIG_SEARCH_PACKAGE_MIN_AGE Changes: - Added `deprecated` field to SearchMappingType and sync it to Elasticsearch - Added `_buildFilterQueries()` method to build Elasticsearch filter conditions - Added `_parseTimeString()` helper to parse time strings (h/d/w format) - Added comprehensive unit tests for the new filter functionality Closes #858 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
How to use the Graphite Merge Queue
Add either label to this PR to merge it via the merge queue:
- MQ - adds this PR to the back of the merge queue
- Hotfix - for urgent hot fixes, skip the queue and merge this PR next
You must have a Graphite account in order to use the merge queue. Sign up using this link.
An organization admin has enabled the Graphite Merge Queue in this repository.
Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.
Important
Review skipped
Draft detected.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
✨ Finishing touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
claude/implement-issue-858-011CURYUu9i46HHcFVRQ5fFV
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds configurable search filters to exclude deprecated packages and newly published packages from search results. The implementation adds Elasticsearch query filters based on two new configuration options: searchExcludeDeprecated (defaults to true) and searchPackageMinAge (supports time format strings like '2w', '14d', '336h').
Key Changes:
- Added
deprecatedfield to Elasticsearch search mapping and sync logic - Implemented
_buildFilterQueries()and_parseTimeString()helper methods in PackageSearchService - Added comprehensive test coverage for both filter configurations
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| config/config.default.ts | Added two new configuration options with environment variable bindings |
| app/port/config.ts | Added TypeScript interface definitions for the new config options with JSDoc |
| app/repository/SearchRepository.ts | Extended SearchMappingType to include 'deprecated' field |
| app/core/service/PackageSearchService.ts | Implemented filter query building logic and time string parsing utility |
| test/port/controller/package/SearchPackageController.test.ts | Added comprehensive test cases for both filter configurations |
Copilot
AI
Oct 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The oxlint-disable comment uses an incorrect rule name. According to the .oxlintrc.json configuration, the correct rule name should be @typescript-eslint/no-explicit-any (with @ prefix), not typescript-eslint/no-explicit-any.
Copilot
AI
Oct 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is in Chinese while the codebase appears to use English for comments elsewhere in this file (lines 131, 348-353). Consider translating to English: '// Latest version deprecated information' to maintain consistency.
...packages
Implemented two new search filter configurations:
searchExcludeDeprecated- Filter deprecated packages from search resultssearchPackageMinAge- Filter newly published packagesChanges:
deprecatedfield to SearchMappingType and sync it to Elasticsearch_buildFilterQueries()method to build Elasticsearch filter conditions_parseTimeString()helper to parse time strings (h/d/w format)Closes #858
🤖 Generated with Claude Code