Skip to content

Commit

Permalink
fix several bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
cleydyr committed Jun 2, 2024
1 parent b6b4c92 commit 156d0b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/main/java/biblivre/circulation/user/IndexableUserDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ private static List<Query> buildAdvancedOptionsQueries(UserSearchDTO dto) {
}

private static List<Query> getMustQueries(UserSearchDTO dto) {
if (dto.isNameOrIdSearch() && !dto.isListAll()) {
return List.of(getMustQueryForName(dto));
if (dto.isSearchById() || dto.isListAll()) {
return Collections.emptyList();
}

return Collections.emptyList();
return List.of(getMustQueryForName(dto));
}

private static Query getMustQueryForName(UserSearchDTO dto) {
Expand All @@ -203,8 +203,8 @@ private static Query getMustQueryForName(UserSearchDTO dto) {
.build();
}

private static Query buildLongTermQuery(UserSearchDTO dto) {
return buildTermQuery("id", value -> value.longValue(Long.parseLong(dto.getQuery())));
private static Query buildUserIdTermQuery(UserSearchDTO dto) {
return buildTermQuery("userId", value -> value.longValue(Long.parseLong(dto.getQuery())));
}

private static Query buildRangeGteQuery(String field, Date value) {
Expand Down Expand Up @@ -303,7 +303,7 @@ private IndexableUser getIndexableUser(UserDTO user) {
String schema = SchemaThreadLocal.get();

return new IndexableUser(
STR."\{schema}:\{userId}",
STR."\{tenant}:\{schema}:\{userId}",
userId,
user.getName(),
user.getType(),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/biblivre/search/user/IndexableUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ public boolean isNew() {

@Override
public String getId() {
return STR."\{schema}:\{userId}";
return id;
}
}

0 comments on commit 156d0b3

Please sign in to comment.