Skip to content

api: Fix search by name#6032

Merged
nvazquez merged 3 commits into
apache:mainfrom
shapeblue:fix-search-by-name
Mar 5, 2022
Merged

api: Fix search by name#6032
nvazquez merged 3 commits into
apache:mainfrom
shapeblue:fix-search-by-name

Conversation

@Pearl1594

Copy link
Copy Markdown
Contributor

Description

This PR aims at restricting using name field in the list APIs to do exact matching as the APIs have a keyword field too. This is an extension of #5782 - specifically addressing the following comment: #5782 (comment)

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

How Has This Been Tested?

@Pearl1594 Pearl1594 added this to the 4.17.0.0 milestone Feb 23, 2022
@Pearl1594 Pearl1594 changed the title Fix search by name api: Fix search by name Feb 23, 2022
@Pearl1594

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@Pearl1594 a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2691

@Pearl1594

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@Pearl1594 a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

}
@Override
public List<ProjectRoleVO> findByName(String name, Long projectId) {
public List<ProjectRoleVO> findByName(String name, Long projectId, String keyword) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this looks to accept both name and keyword and search for name adhering to both. Is that intended?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Name would take precedence @DaanHoogland , so it's effectively not going to use the keyword passes. I can actually remove it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@DaanHoogland
yes, in most list apis, keyword is acceptable with other parameters like name, type, etc.

for this particular api, I personally think it is not necessary to accept keyword
but, it is ok to me.

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clgtm

sc.setParameters("project_id", projectId);
}
if (StringUtils.isNotEmpty(keyword)) {
SearchCriteria<ProjectRoleVO> ssc = createSearchCriteria();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Pearl1594
why not use

sc.setParameters("keyword", keyword);

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-3416)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 30757 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6032-t3416-kvm-centos7.zip
Smoke tests completed. 92 look OK, 0 have errors
Only failed tests results shown below:

Test Result Time (s) Test File

@yadvr yadvr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lgtm, we already have keyword param for fuzzy search

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants