Skip to content

Commit

Permalink
[TRELLO-2001] Fix company search (#1450)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlescd authored Sep 19, 2023
1 parent cdabb09 commit 25fd63d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/repositories/company/CompanyRepository.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ class CompanyRepository(override val dbConfig: DatabaseConfig[JdbcProfile])(impl
case SearchCompanyIdentitySiret(q) => query.filter(_._1.siret === SIRET.fromUnsafe(q))
case SearchCompanyIdentitySiren(q) => query.filter(_._1.siret.asColumnOf[String] like s"${q}_____")
case SearchCompanyIdentityName(q) =>
query.filter(tuple => toTsVector(tuple._1.name ++ " " ++ tuple._1.brand) @@ plainToTsQuery(q))
query.filter { tuple =>
val searchString = tuple._1.brand.map(brand => tuple._1.name ++ " " ++ brand).getOrElse(tuple._1.name)
toTsVector(searchString) @@ plainToTsQuery(q)
}
case id: SearchCompanyIdentityId => query.filter(_._1.id === id.value)
}
.getOrElse(query)
Expand Down

0 comments on commit 25fd63d

Please sign in to comment.