fix(search): add case insensitive
This commit is contained in:
parent
b983f4e3ec
commit
4e9686d6a7
@ -91,10 +91,10 @@ public class ClubService {
|
||||
PanacheQuery<ClubModel> query;
|
||||
|
||||
if (country == null || country.isBlank())
|
||||
query = repository.find("name LIKE ?1",
|
||||
query = repository.find("LOWER(name) LIKE LOWER(?1)",
|
||||
Sort.ascending("name"), search).page(Page.ofSize(limit));
|
||||
else
|
||||
query = repository.find("name LIKE ?1 AND country LIKE ?2",
|
||||
query = repository.find("LOWER(name) LIKE LOWER(?1) AND country LIKE ?2",
|
||||
Sort.ascending("name"), search, country + "%").page(Page.ofSize(limit));
|
||||
return getPageResult(query, limit, page);
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class MembreService {
|
||||
|
||||
public SimpleCombModel find(int licence, String np) throws Throwable {
|
||||
return VertxContextSupport.subscribeAndAwait(() -> Panache.withTransaction(() ->
|
||||
repository.find("licence = ?1 AND (lname ILIKE ?2 OR fname ILIKE ?2)",
|
||||
repository.find("licence = ?1 AND (LOWER(lname) LIKE LOWER(?2) OR LOWER(fname) LIKE LOWER(?2))",
|
||||
licence, np).firstResult().map(SimpleCombModel::fromModel)));
|
||||
}
|
||||
|
||||
@ -85,10 +85,10 @@ public class MembreService {
|
||||
PanacheQuery<MembreModel> query;
|
||||
|
||||
if (club == null || club.isBlank())
|
||||
query = repository.find("(lname LIKE ?1 OR fname LIKE ?1)",
|
||||
query = repository.find("(LOWER(lname) LIKE LOWER(?1) OR LOWER(fname) LIKE LOWER(?1))",
|
||||
Sort.ascending("fname", "lname"), search).page(Page.ofSize(limit));
|
||||
else
|
||||
query = repository.find("club.name LIKE ?2 AND (lname LIKE ?1 OR fname LIKE ?1)",
|
||||
query = repository.find("LOWER(club.name) LIKE LOWER(?2) AND (LOWER(lname) LIKE LOWER(?1) OR LOWER(fname) LIKE LOWER(?1))",
|
||||
Sort.ascending("fname", "lname"), search, club + "%").page(Page.ofSize(limit));
|
||||
return getPageResult(query, limit, page);
|
||||
}
|
||||
@ -100,7 +100,7 @@ public class MembreService {
|
||||
String finalSearch = search;
|
||||
return repository.find("userId = ?1", subject).firstResult()
|
||||
.chain(membreModel -> {
|
||||
PanacheQuery<MembreModel> query = repository.find("club = ?1 AND (lname LIKE ?2 OR fname LIKE ?2)",
|
||||
PanacheQuery<MembreModel> query = repository.find("club = ?1 AND (LOWER(lname) LIKE LOWER(?2) OR LOWER(fname) LIKE LOWER(?2))",
|
||||
Sort.ascending("fname", "lname"), membreModel.getClub(), finalSearch)
|
||||
.page(Page.ofSize(limit));
|
||||
return getPageResult(query, limit, page);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user