-
Notifications
You must be signed in to change notification settings - Fork 1
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
combine endpoints; deprecate old search endpoint and update readme #346
base: develop
Are you sure you want to change the base?
combine endpoints; deprecate old search endpoint and update readme #346
Conversation
|
||
if (queryMap.isEmpty()) { | ||
if (searchText != null && !searchText.isEmpty()) { | ||
Project project = this.projectDAO.getProjectById(searchText); |
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.
Just curious. Is there any occasion that the searchText is null but searchText is not empty or the other way around?
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.
oh the other way, sometimes text could be empty string ""
if (project != null) { | ||
projects.add(project); | ||
} else { | ||
projects = this.projectDAO.searchProjects(searchText); |
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.
what if this projects is also null?
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.
I think the search function will always return list, if not found then empty list.
@Override
public List<Project> searchProjects(String text) {
Query<Project> query = this.dataStore.find(Project.class).filter(
Filters.or(
Filters.regex(PROJECT_FIELD_NAME).pattern(text).caseInsensitive(),
Filters.regex(PROJECT_FIELD_DESCRIPTION).pattern(text).caseInsensitive(),
Filters.regex(PROJECT_FIELD_CREATOR).pattern(text).caseInsensitive(),
Filters.regex(PROJECT_FIELD_OWNER).pattern(text).caseInsensitive(),
Filters.regex(PROJECT_FIELD_REGION).pattern(text).caseInsensitive()
));
return query.iterator().toList();
}
```
No description provided.