change pagestable to visitors and update clickhouse hostname column to array
This commit is contained in:
@@ -21,6 +21,12 @@ async function relationalQuery(
|
||||
const { rawQuery, getSearchSQL } = prisma;
|
||||
const params = {};
|
||||
let searchQuery = '';
|
||||
let excludeDomain = '';
|
||||
|
||||
if (column === 'referrer_domain') {
|
||||
excludeDomain = `and website_event.referrer_domain != website_event.hostname
|
||||
and website_event.referrer_domain != ''`;
|
||||
}
|
||||
|
||||
if (search) {
|
||||
if (decodeURIComponent(search).includes(',')) {
|
||||
@@ -49,6 +55,7 @@ async function relationalQuery(
|
||||
where website_event.website_id = {{websiteId::uuid}}
|
||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||
${searchQuery}
|
||||
${excludeDomain}
|
||||
group by 1
|
||||
order by 2 desc
|
||||
limit 10
|
||||
@@ -73,6 +80,11 @@ async function clickhouseQuery(
|
||||
const { rawQuery, getSearchSQL } = clickhouse;
|
||||
const params = {};
|
||||
let searchQuery = '';
|
||||
let excludeDomain = '';
|
||||
|
||||
if (column === 'referrer_domain') {
|
||||
excludeDomain = `and referrer_domain != hostname and referrer_domain != ''`;
|
||||
}
|
||||
|
||||
if (search) {
|
||||
searchQuery = `and positionCaseInsensitive(${column}, {search:String}) > 0`;
|
||||
@@ -103,6 +115,7 @@ async function clickhouseQuery(
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
${searchQuery}
|
||||
${excludeDomain}
|
||||
group by 1
|
||||
order by 2 desc
|
||||
limit 10
|
||||
|
||||
Reference in New Issue
Block a user