Skip to content

Commit

Permalink
fix(pool): name search behaviour
Browse files Browse the repository at this point in the history
- now is case-insensitive
- matches on parts of words
  • Loading branch information
nicoprow committed May 22, 2024
1 parent fb07739 commit 4b79e56
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface LegalEntityRepository : JpaRepository<LegalEntityDb, Long>, JpaSpecifi
fun byLegalName(legalName: String?) =
Specification<LegalEntityDb> { root, _, builder ->
legalName?.takeIf { it.isNotBlank() }?.let {
builder.like(root.get<NameDb>(LegalEntityDb::legalName.name).get(NameDb::value.name), legalName)
builder.like(builder.lower(root.get<NameDb>(LegalEntityDb::legalName.name).get(NameDb::value.name)), "%${legalName.lowercase()}%")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ interface LogisticAddressRepository : JpaRepository<LogisticAddressDb, Long>, Jp
fun byName(name: String?) =
Specification<LogisticAddressDb> { root, _, builder ->
name?.takeIf { it.isNotBlank() }?.let {
builder.like(root.get(LogisticAddressDb::name.name), name)
builder.like(builder.lower(root.get(LogisticAddressDb::name.name)), "%${name.lowercase()}%")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interface SiteRepository : JpaRepository<SiteDb, Long>, JpaSpecificationExecutor
fun byName(name: String?) =
Specification<SiteDb> { root, _, builder ->
name?.takeIf { it.isNotBlank() }?.let {
builder.like(root.get(SiteDb::name.name), name)
builder.like(builder.lower(root.get(SiteDb::name.name)), "%${name.lowercase()}%")
}
}

Expand Down

0 comments on commit 4b79e56

Please sign in to comment.