I am building a simple search functionality, the records can be like
AB CD
A BCD
ABC D
ABD C
now, if I give "BCD
" as the search text,
I should be able to get
AB CD
A BCD
ABC D
Below, is the current query
await connection.manager
.createQueryBuilder(RefTransaction, 'rt')
.where('rt.key LIKE :searchText',
{searchText: '%' + <searchText> + '%' })
.getRawMany();
How should I modify this ?
Post Note : Just read about replace function in MySQL, how can I use that in typeorm for the purpose mentioned
await connection.manager
.createQueryBuilder(RefTransaction, 'rt')
.where('replace(rt.key, " ", "") LIKE :searchText',
{searchText: '%' + <searchText>.replace(" ","") + '%' })
.getRawMany();