Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Fixed search. Updated queries to not use domain.

Mike Cao1d15a8837019
diff --git a/src/components/metrics/ChannelsTable.tsx b/src/components/metrics/ChannelsTable.tsx
index c7b3906d5..d2dc207f8 100644
--- a/src/components/metrics/ChannelsTable.tsx
+++ b/src/components/metrics/ChannelsTable.tsx
@@ -1,7 +1,7 @@
import MetricsTable, { MetricsTableProps } from '@/components/metrics/MetricsTable';
import { useMessages } from '@/components/hooks';
-export function BrowsersTable(props: MetricsTableProps) {
+export function ChannelsTable(props: MetricsTableProps) {
const { formatMessage, labels } = useMessages();
const renderLabel = ({ x }) => {
@@ -19,4 +19,4 @@ export function BrowsersTable(props: MetricsTableProps) {
);
}
-export default BrowsersTable;
+export default ChannelsTable;
diff --git a/src/lib/clickhouse.ts b/src/lib/clickhouse.ts
index 7b6291c0c..480084dc7 100644
--- a/src/lib/clickhouse.ts
+++ b/src/lib/clickhouse.ts
@@ -95,7 +95,7 @@ function getFilterQuery(filters: QueryFilters = {}, options: QueryOptions = {})
arr.push(`and ${mapFilter(column, operator, name)}`);
if (name === 'referrer') {
- arr.push('and referrer_domain != hostname');
+ arr.push(`and referrer_domain != hostname`);
}
}
@@ -145,7 +145,6 @@ async function parseFilters(websiteId: string, filters: QueryFilters = {}, optio
...getFilterParams(filters),
websiteId,
startDate: maxDate(filters.startDate, new Date(website?.resetAt)),
- websiteDomain: website.domain,
},
};
}
@@ -162,7 +161,7 @@ async function pagedQuery(
const statements = [
orderBy && `order by ${orderBy} ${direction}`,
- +size > 0 && `limit ${+size} offset ${offset}`,
+ +size > 0 && `limit ${+size} offset ${+offset}`,
]
.filter(n => n)
.join('\n');
diff --git a/src/lib/prisma.ts b/src/lib/prisma.ts
index 6c0237d05..e2f50a6c7 100644
--- a/src/lib/prisma.ts
+++ b/src/lib/prisma.ts
@@ -151,7 +151,7 @@ function getFilterQuery(filters: QueryFilters = {}, options: QueryOptions = {}):
if (name === 'referrer') {
arr.push(
- 'and (website_event.referrer_domain != {{websiteDomain}} or website_event.referrer_domain is null)',
+ `and (website_event.referrer_domain != session.hostname or website_event.referrer_domain is null)`,
);
}
}
@@ -205,7 +205,6 @@ async function parseFilters(
...getFilterParams(filters),
websiteId,
startDate: maxDate(filters.startDate, website?.resetAt),
- websiteDomain: website.domain,
},
};
}
diff --git a/src/lib/schema.ts b/src/lib/schema.ts
index 9fca4b8a3..8df7be9fa 100644
--- a/src/lib/schema.ts
+++ b/src/lib/schema.ts
@@ -23,7 +23,7 @@ export const pagingParams = {
page: z.coerce.number().int().positive().optional(),
pageSize: z.coerce.number().int().positive().optional(),
orderBy: z.string().optional(),
- query: z.string().optional(),
+ search: z.string().optional(),
};
export const timezoneParam = z.string().refine(value => isValidTimezone(value), {
diff --git a/src/queries/sql/pageviews/getPageviewMetrics.ts b/src/queries/sql/pageviews/getPageviewMetrics.ts
index 4a0d3361e..0b472e951 100644
--- a/src/queries/sql/pageviews/getPageviewMetrics.ts
+++ b/src/queries/sql/pageviews/getPageviewMetrics.ts
@@ -103,7 +103,7 @@ async function clickhouseQuery(
let entryExitQuery = '';
if (column === 'referrer_domain') {
- excludeDomain = `and referrer_domain != {websiteDomain:String} and referrer_domain != ''`;
+ excludeDomain = `and referrer_domain != hostname and referrer_domain != ''`;
}
if (type === 'entry' || type === 'exit') {
@@ -139,7 +139,7 @@ async function clickhouseQuery(
let groupByQuery = '';
if (column === 'referrer_domain') {
- excludeDomain = `and t != {websiteDomain:String} and t != ''`;
+ excludeDomain = `and t != hostname`;
}
let columnQuery = `arrayJoin(${column})`;