mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 20:45:39 +01:00
Autoconvert filters with * to LIKE queryies
This commit is contained in:
parent
4389fd72c2
commit
5b7e382347
1 changed files with 8 additions and 0 deletions
|
|
@ -112,6 +112,14 @@ function getFilterQuery(filters: QueryFilters = {}, options: QueryOptions = {}):
|
|||
const column = FILTER_COLUMNS[name] ?? options?.columns?.[name];
|
||||
|
||||
if (value !== undefined && column) {
|
||||
if (value?.value) {
|
||||
if (typeof value.value === 'string' && value.value.indexOf('*') > -1) {
|
||||
// If input contains *, convert to a LIKE
|
||||
value.value = value.value.replace(/%/, '\\%').replace('*', '%');
|
||||
value.filter = OPERATORS.like;
|
||||
}
|
||||
}
|
||||
|
||||
arr.push(`and ${mapFilter(column, operator, name)}`);
|
||||
|
||||
if (name === 'referrer') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue