Add option to not consider word boundaries when processing keyword filtering (#7975)
* Add option to not consider word boundaries when filtering phrases * Add a few tests for keyword/phrase filtering
This commit is contained in:
parent
451e585b97
commit
1ca4e51eb3
9 changed files with 61 additions and 11 deletions
|
@ -45,7 +45,10 @@ export const regexFromFilters = filters => {
|
|||
return null;
|
||||
}
|
||||
|
||||
return new RegExp(filters.map(filter => escapeRegExp(filter.get('phrase'))).map(expr => `\\b${expr}\\b`).join('|'), 'i');
|
||||
return new RegExp(filters.map(filter => {
|
||||
let expr = escapeRegExp(filter.get('phrase'));
|
||||
return filter.get('whole_word') ? `\\b${expr}\\b` : expr;
|
||||
}).join('|'), 'i');
|
||||
};
|
||||
|
||||
export const makeGetStatus = () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue