fixes on search (#11955)
In this PR - enable search by email - search with ' ' (spaces) string and special characters do not throw entry error closes https://github.com/twentyhq/twenty/issues/11447 & https://github.com/twentyhq/core-team-issues/issues/860
This commit is contained in:
@ -30,15 +30,8 @@ describe('getTsVectorColumnExpressionFromFields', () => {
|
||||
const result = getTsVectorColumnExpressionFromFields(fields);
|
||||
const expected = `
|
||||
to_tsvector('simple', COALESCE("nameFirstName", '') || ' ' || COALESCE("nameLastName", '') || ' ' || COALESCE("jobTitle", '') || ' ' ||
|
||||
COALESCE(
|
||||
replace(
|
||||
"emailsPrimaryEmail",
|
||||
'@',
|
||||
' '
|
||||
),
|
||||
''
|
||||
)
|
||||
)
|
||||
COALESCE("emailsPrimaryEmail", '') || ' ' ||
|
||||
COALESCE(SPLIT_PART("emailsPrimaryEmail", '@', 2), ''))
|
||||
`.trim();
|
||||
|
||||
expect(result.trim()).toBe(expected);
|
||||
|
||||
@ -82,15 +82,9 @@ const getColumnExpression = (
|
||||
switch (fieldType) {
|
||||
case FieldMetadataType.EMAILS:
|
||||
return `
|
||||
COALESCE(
|
||||
replace(
|
||||
${quotedColumnName},
|
||||
'@',
|
||||
' '
|
||||
),
|
||||
''
|
||||
)
|
||||
`;
|
||||
COALESCE(${quotedColumnName}, '') || ' ' ||
|
||||
COALESCE(SPLIT_PART(${quotedColumnName}, '@', 2), '')`;
|
||||
|
||||
default:
|
||||
return `COALESCE(${quotedColumnName}, '')`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user