[ACS-6427] Apply * for TEXT field for highlighting (#3659)

This commit is contained in:
MichalKinas 2024-02-21 12:20:00 +01:00 committed by GitHub
parent 3f182a5a68
commit 1141b810cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 14 deletions

View File

@ -178,11 +178,6 @@ describe('SearchComponent', () => {
expect(query).toBe(`(cm:name:"hello*" OR cm:title:"hello*")`);
});
it('should not apply suffix to the TEXT field for correct highlighting', () => {
const query = component.formatSearchQuery('hello', ['cm:name', 'TEXT']);
expect(query).toBe(`(cm:name:"hello*" OR TEXT:"hello")`);
});
it('should format user input as cm:name if configuration not provided', () => {
const query = component.formatSearchQuery('hello');
expect(query).toBe(`(cm:name:"hello*")`);

View File

@ -206,15 +206,7 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
term = term.substring(1);
}
return (
'(' +
fields
.map((field) => {
return field !== 'TEXT' ? `${prefix}${field}:"${term}${suffix}"` : `${prefix}${field}:"${term}"`;
})
.join(' OR ') +
')'
);
return '(' + fields.map((field) => `${prefix}${field}:"${term}${suffix}"`).join(' OR ') + ')';
}
formatSearchQuery(userInput: string, fields = ['cm:name']) {