Skip to content
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: package自定义搜索支持版本名、元数据、checksum搜索 #1717 #1739

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

scplsy
Copy link
Collaborator

@scplsy scplsy commented Jan 29, 2024

issue

  1. package自定义搜索支持版本相关条件 #1717

描述

package自定义搜索新增以下搜索条件:

  1. 包含的版本号(模糊搜索)
  2. 包含的版本元数据
  3. 包含的版本的checksum

添加这些搜索条件时,搜索结果仍然为packages,但每个返回的package详情都将新增matchedVersions数组字段,值为匹配的版本号。

@scplsy scplsy self-assigned this Jan 29, 2024
@scplsy scplsy force-pushed the issue_1717 branch 2 times, most recently from 3b07438 to ef8e7e8 Compare January 29, 2024 12:35
(cherry picked from commit f44cef4faca90b83052243c709d735104154de3e)
require(context is PackageQueryContext)
// 查找符合条件的version
val versionQuery = Query(getVersionCriteria(rule, context))
val versionMap = queryRecords(versionQuery) { query -> packageVersionDao.find(query) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 这里没限制项目和仓库,是不是会把整个制品库所有项目符合条件的包都查出来放在内存里
  2. 能不能把version、metadata、checksum条件集中在一次查询中把数据都查出来

.groupBy({ it.packageId }, { it.name })
// 多个版本查询规则在同一个package的版本号交集
for ((key, value) in versionMap) {
context.matchedVersions.putIfAbsent(key, value.toMutableSet())?.retainAll(value.toSet())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这边value转了两次set,应该转换一次就够了

@scplsy scplsy added the wip work in progess label Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wip work in progess
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants