cnpmcore icon indicating copy to clipboard operation
cnpmcore copied to clipboard

feat: add search filters for deprecated packages and newly published …

Open fengmk2 opened this issue 2 months ago • 2 comments

…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

fengmk2 avatar Oct 24 '25 08:10 fengmk2

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.

graphite-app[bot] avatar Oct 24 '25 08:10 graphite-app[bot]

[!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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Oct 24 '25 08:10 coderabbitai[bot]