mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-6427] Apply * for TEXT field for highlighting (#3659)
This commit is contained in:
parent
3f182a5a68
commit
1141b810cb
@ -178,11 +178,6 @@ describe('SearchComponent', () => {
|
|||||||
expect(query).toBe(`(cm:name:"hello*" OR cm:title:"hello*")`);
|
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', () => {
|
it('should format user input as cm:name if configuration not provided', () => {
|
||||||
const query = component.formatSearchQuery('hello');
|
const query = component.formatSearchQuery('hello');
|
||||||
expect(query).toBe(`(cm:name:"hello*")`);
|
expect(query).toBe(`(cm:name:"hello*")`);
|
||||||
|
@ -206,15 +206,7 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
|
|||||||
term = term.substring(1);
|
term = term.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return '(' + fields.map((field) => `${prefix}${field}:"${term}${suffix}"`).join(' OR ') + ')';
|
||||||
'(' +
|
|
||||||
fields
|
|
||||||
.map((field) => {
|
|
||||||
return field !== 'TEXT' ? `${prefix}${field}:"${term}${suffix}"` : `${prefix}${field}:"${term}"`;
|
|
||||||
})
|
|
||||||
.join(' OR ') +
|
|
||||||
')'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
formatSearchQuery(userInput: string, fields = ['cm:name']) {
|
formatSearchQuery(userInput: string, fields = ['cm:name']) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user