Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

[Search] Increase search reporting (#62200)

Sloan Sparger694fbaa5a2e9
diff --git a/e2e/test/scenarios/search/search-snowplow.cy.spec.js b/e2e/test/scenarios/search/search-snowplow.cy.spec.js
index 52cfcff1fb6..e8ff8a6c7ca 100644
--- a/e2e/test/scenarios/search/search-snowplow.cy.spec.js
+++ b/e2e/test/scenarios/search/search-snowplow.cy.spec.js
@@ -1,3 +1,5 @@
+import { P, isMatching } from "ts-pattern";
+
const { H } = cy;
import { commandPaletteInput } from "../../../support/helpers/e2e-command-palette-helpers";
@@ -24,24 +26,39 @@ H.describeWithSnowplow("scenarios > search > snowplow", () => {
H.commandPaletteSearch("Orders", false);
//Passing a function to ensure that runtime_milliseconds is populated as a number
- H.expectUnstructuredSnowplowEvent((data) => {
- if (!data) {
- return false;
- }
- return (
- data.event === NEW_SEARCH_QUERY_EVENT_NAME &&
- data.context === "command-palette" &&
- typeof data.runtime_milliseconds === "number"
- );
- });
+ H.expectUnstructuredSnowplowEvent((event) =>
+ isMatching(
+ {
+ event: NEW_SEARCH_QUERY_EVENT_NAME,
+ context: "command-palette",
+ runtime_milliseconds: P.number,
+ search_engine: P.string,
+ request_id: P.string,
+ offset: null,
+ search_term_hash: P.string,
+ search_term: null,
+ },
+ event,
+ ),
+ );
H.commandPalette().findByRole("option", { name: "Orders Model" }).click();
H.expectUnstructuredSnowplowEvent(
- {
- event: SEARCH_CLICK,
- context: "command-palette",
- position: 3,
- },
+ (event) =>
+ isMatching(
+ {
+ event: SEARCH_CLICK,
+ target_type: "item",
+ context: "command-palette",
+ position: 3,
+ search_engine: P.string,
+ request_id: P.string,
+ entity_model: P.string,
+ search_term_hash: P.string,
+ search_term: null,
+ },
+ event,
+ ),
1,
);
});
@@ -51,16 +68,16 @@ H.describeWithSnowplow("scenarios > search > snowplow", () => {
H.commandPaletteSearch("Orders", false);
//Passing a function to ensure that runtime_milliseconds is populated as a number
- H.expectUnstructuredSnowplowEvent((data) => {
- if (!data) {
- return false;
- }
- return (
- data.event === NEW_SEARCH_QUERY_EVENT_NAME &&
- data.context === "command-palette" &&
- typeof data.runtime_milliseconds === "number"
- );
- });
+ H.expectUnstructuredSnowplowEvent((event) =>
+ isMatching(
+ {
+ event: NEW_SEARCH_QUERY_EVENT_NAME,
+ context: "command-palette",
+ runtime_milliseconds: P.number,
+ },
+ event,
+ ),
+ );
// FIX ME: We need to slow cypress down before we start inputting keyboard events.
// Not clear why though :/.
diff --git a/frontend/src/metabase-types/analytics/search.ts b/frontend/src/metabase-types/analytics/search.ts
index ec599e16361..76afb047224 100644
--- a/frontend/src/metabase-types/analytics/search.ts
+++ b/frontend/src/metabase-types/analytics/search.ts
@@ -14,6 +14,12 @@ type SearchEventSchema = {
verified_items?: boolean | null;
search_native_queries?: boolean | null;
search_archived?: boolean | null;
+ search_engine?: string | null;
+ request_id?: string | null;
+ offset?: number | null;
+ entity_model?: string | null;
+ search_term_hash?: string | null;
+ search_term?: string | null;
};
type ValidateEvent<
@@ -42,6 +48,8 @@ type SearchContext =
export type SearchQueryEvent = ValidateEvent<{
event: "search_query";
+ search_term_hash: string | null;
+ search_term: string | null;
runtime_milliseconds: number;
context: SearchContext | null;
total_results: number;
@@ -54,6 +62,9 @@ export type SearchQueryEvent = ValidateEvent<{
verified_items: boolean;
search_native_queries: boolean;
search_archived: boolean;
+ search_engine: string | null;
+ request_id: string | null;
+ offset: number | null;
}>;
export type SearchClickEvent = ValidateEvent<{
@@ -61,6 +72,11 @@ export type SearchClickEvent = ValidateEvent<{
position: number;
target_type: "item" | "view_more";
context: SearchContext | null;
+ search_engine: string | null;
+ request_id: string | null;
+ entity_model: string | null;
+ search_term_hash: string | null;
+ search_term: string | null;
}>;
export type SearchEvent = SearchQueryEvent | SearchClickEvent;
diff --git a/frontend/src/metabase-types/api/mocks/search.ts b/frontend/src/metabase-types/api/mocks/search.ts
index 503a61f5394..296eb76873a 100644
--- a/frontend/src/metabase-types/api/mocks/search.ts
+++ b/frontend/src/metabase-types/api/mocks/search.ts
@@ -64,6 +64,7 @@ export const createMockSearchResults = ({
offset: 0,
table_db_id: null,
total: items.length,
+ engine: "search.engine/appdb",
...options,
};
};
diff --git a/frontend/src/metabase-types/api/mocks/settings.ts b/frontend/src/metabase-types/api/mocks/settings.ts
index 7c0e27c79e6..1655ca56f46 100644
--- a/frontend/src/metabase-types/api/mocks/settings.ts
+++ b/frontend/src/metabase-types/api/mocks/settings.ts
@@ -154,6 +154,7 @@ export const createMockSettingDefinition = <
export const createMockSettings = (
opts?: Partial<Settings | EnterpriseSettings>,
): EnterpriseSettings => ({
+ "analytics-uuid": "eefb3320-1d3f-4686-a22a-1d30ae729525",
"admin-email": "[email protected]",
"airgap-enabled": false,
"allowed-iframe-hosts": "*",
diff --git a/frontend/src/metabase-types/api/search.ts b/frontend/src/metabase-types/api/search.ts
index 4719b7be8fc..f09c5ddc7c0 100644
--- a/frontend/src/metabase-types/api/search.ts
+++ b/frontend/src/metabase-types/api/search.ts
@@ -48,6 +48,7 @@ export type SearchResponse<
models: Model[] | null;
available_models: SearchModel[];
table_db_id: DatabaseId | null;
+ engine: string;
} & PaginationResponse;
export type CollectionEssentials = Pick<
diff --git a/frontend/src/metabase-types/api/settings.ts b/frontend/src/metabase-types/api/settings.ts
index d3769b96719..2632729dd6c 100644
--- a/frontend/src/metabase-types/api/settings.ts
+++ b/frontend/src/metabase-types/api/settings.ts
@@ -438,6 +438,7 @@ type PrivilegedSettings = AdminSettings & SettingsManagerSettings;
interface PublicSettings {
"allowed-iframe-hosts": string;
+ "analytics-uuid": string;
"anon-tracking-enabled": boolean;
"application-font": string;
"application-font-files": FontFile[] | null;
diff --git a/frontend/src/metabase/api/search.ts b/frontend/src/metabase/api/search.ts
index 582dff5bbcc..b37180ea1fa 100644
--- a/frontend/src/metabase/api/search.ts
+++ b/frontend/src/metabase/api/search.ts
@@ -14,12 +14,12 @@ export const searchApi = Api.injectEndpoints({
}),
providesTags: (response, error, { models }) =>
provideSearchItemListTags(response?.data ?? [], models),
- onQueryStarted: (args, { queryFulfilled }) => {
+ onQueryStarted: (args, { queryFulfilled, requestId }) => {
if (args.context) {
const start = Date.now();
queryFulfilled.then(({ data }) => {
const duration = Date.now() - start;
- trackSearchRequest(args, data, duration);
+ trackSearchRequest(args, data, duration, requestId);
});
}
},
diff --git a/frontend/src/metabase/common/components/EntityPicker/components/EntityPickerModal/EntityPickerModal.tsx b/frontend/src/metabase/common/components/EntityPicker/components/EntityPickerModal/EntityPickerModal.tsx
index 69aee2606aa..608483dec0c 100644
--- a/frontend/src/metabase/common/components/EntityPicker/components/EntityPickerModal/EntityPickerModal.tsx
+++ b/frontend/src/metabase/common/components/EntityPicker/components/EntityPickerModal/EntityPickerModal.tsx
@@ -182,7 +182,7 @@ export function EntityPickerModal<
const [debouncedSearchQuery, setDebouncedSearchQuery] = useState(searchQuery);
useDebounce(() => setDebouncedSearchQuery(searchQuery), 200, [searchQuery]);
- const { data, isFetching } = useSearchQuery(
+ const { data, isFetching, requestId } = useSearchQuery(
{
q: debouncedSearchQuery,
models: searchModels,
@@ -263,6 +263,9 @@ export function EntityPickerModal<
isLoading={isFetching}
searchScope={searchScope}
searchResults={finalSearchResults ?? []}
+ searchEngine={data?.engine}
+ searchRequestId={requestId}
+ searchTerm={searchQuery}
selectedItem={selectedItem}
onItemSelect={onItemSelect}
onSearchScopeChange={setSearchScope}
diff --git a/frontend/src/metabase/common/components/EntityPicker/components/SearchTab/SearchResults.tsx b/frontend/src/metabase/common/components/EntityPicker/components/SearchTab/SearchResults.tsx
index 96604c3384f..57734aaf7ba 100644
--- a/frontend/src/metabase/common/components/EntityPicker/components/SearchTab/SearchResults.tsx
+++ b/frontend/src/metabase/common/components/EntityPicker/components/SearchTab/SearchResults.tsx
@@ -17,6 +17,9 @@ interface Props<
> {
folder: Item | undefined;
searchResults: SearchItem[];
+ searchEngine?: string;
+ searchRequestId?: string;
+ searchTerm?: string;
selectedItem: Item | null;
onItemSelect: (item: Item) => void;
}
@@ -28,6 +31,9 @@ export const SearchResults = <
>({
folder,
searchResults,
+ searchEngine,
+ searchRequestId,
+ searchTerm,
selectedItem,
onItemSelect,
}: Props<Id, Model, Item>) => {
@@ -48,7 +54,15 @@ export const SearchResults = <
key={item.model + item.id}
item={item}
onClick={() => {
- trackSearchClick("item", index, "entity-picker");
+ trackSearchClick({
+ itemType: "item",
+ position: index,
+ context: "entity-picker",
+ searchEngine: searchEngine || "unknown",
+ requestId: searchRequestId,
+ entityModel: item.model,
+ searchTerm,
+ });
onItemSelect(item as unknown as Item);
}}
isSelected={
diff --git a/frontend/src/metabase/common/components/EntityPicker/components/SearchTab/SearchTab.tsx b/frontend/src/metabase/common/components/EntityPicker/components/SearchTab/SearchTab.tsx
index 37a6f410c79..0b6c132f807 100644
--- a/frontend/src/metabase/common/components/EntityPicker/components/SearchTab/SearchTab.tsx
+++ b/frontend/src/metabase/common/components/EntityPicker/components/SearchTab/SearchTab.tsx
@@ -22,6 +22,9 @@ interface Props<
isLoading: boolean;
searchScope: EntityPickerSearchScope;
searchResults: SearchItem[];
+ searchEngine?: string;
+ searchRequestId?: string;
+ searchTerm?: string;
selectedItem: Item | null;
onItemSelect: (item: Item) => void;
onSearchScopeChange: (scope: EntityPickerSearchScope) => void;
@@ -36,6 +39,9 @@ export const SearchTab = <
isLoading,
searchScope,
searchResults,
+ searchEngine,
+ searchRequestId,
+ searchTerm,
selectedItem,
onItemSelect,
onSearchScopeChange,
@@ -83,6 +89,9 @@ export const SearchTab = <
<SearchResults
folder={folder}
searchResults={searchResults}
+ searchEngine={searchEngine}
+ searchRequestId={searchRequestId}
+ searchTerm={searchTerm}
selectedItem={selectedItem}
onItemSelect={onItemSelect}
/>
diff --git a/frontend/src/metabase/lib/analytics.ts b/frontend/src/metabase/lib/analytics.ts
index 39865379028..7ff8cf70091 100644
--- a/frontend/src/metabase/lib/analytics.ts
+++ b/frontend/src/metabase/lib/analytics.ts
@@ -28,7 +28,7 @@ const VERSIONS: Record<SchemaType, SchemaVersion> = {
invite: "1-0-1",
model: "1-0-0",
question: "1-0-6",
- search: "1-1-0",
+ search: "1-2-0",
serialization: "1-0-1",
settings: "1-0-2",
setup: "1-0-3",
diff --git a/frontend/src/metabase/nav/components/search/SearchResults/SearchResults.tsx b/frontend/src/metabase/nav/components/search/SearchResults/SearchResults.tsx
index 18b9470bad6..ef86ad98a6b 100644
--- a/frontend/src/metabase/nav/components/search/SearchResults/SearchResults.tsx
+++ b/frontend/src/metabase/nav/components/search/SearchResults/SearchResults.tsx
@@ -168,6 +168,7 @@ export const SearchResults = ({
onClick={onClick}
index={index}
context="search-bar"
+ searchTerm={searchText}
/>
</li>
);
diff --git a/frontend/src/metabase/palette/hooks/useCommandPalette.tsx b/frontend/src/metabase/palette/hooks/useCommandPalette.tsx
index 40a23fec35a..6408845db10 100644
--- a/frontend/src/metabase/palette/hooks/useCommandPalette.tsx
+++ b/frontend/src/metabase/palette/hooks/useCommandPalette.tsx
@@ -72,6 +72,7 @@ export const useCommandPalette = ({
currentData: searchResults,
isFetching: isSearchLoading,
error: searchError,
+ requestId: searchRequestId,
} = useSearchQuery(
{
q: debouncedSearchText,
@@ -174,7 +175,15 @@ export const useCommandPalette = ({
keywords: debouncedSearchText,
icon: "link" as IconName,
perform: () => {
- trackSearchClick("view_more", 0, "command-palette");
+ trackSearchClick({
+ itemType: "view_more",
+ position: 0,
+ context: "command-palette",
+ searchEngine: searchResults?.engine || "unknown",
+ requestId: searchRequestId,
+ entityModel: null,
+ searchTerm: debouncedSearchText,
+ });
},
priority: Priority.HIGH,
extra: {
@@ -194,7 +203,15 @@ export const useCommandPalette = ({
keywords: debouncedSearchText,
priority: Priority.NORMAL - index,
perform: () => {
- trackSearchClick("item", index, "command-palette");
+ trackSearchClick({
+ itemType: "item",
+ position: index,
+ context: "command-palette",
+ searchEngine: searchResults?.engine || "unknown",
+ requestId: searchRequestId,
+ entityModel: result.model,
+ searchTerm: debouncedSearchText,
+ });
},
extra: {
moderatedStatus: result.moderated_status,
@@ -227,6 +244,7 @@ export const useCommandPalette = ({
searchResults,
locationQuery,
isSearchTypeaheadEnabled,
+ searchRequestId,
]);
useRegisterActions(searchResultActions, [searchResultActions]);
diff --git a/frontend/src/metabase/search/analytics.ts b/frontend/src/metabase/search/analytics.ts
index 27bfeec0458..7871fa99abc 100644
--- a/frontend/src/metabase/search/analytics.ts
+++ b/frontend/src/metabase/search/analytics.ts
@@ -1,6 +1,12 @@
import { trackSchemaEvent } from "metabase/lib/analytics";
+import Settings from "metabase/lib/settings";
import type { SearchRequest, SearchResponse } from "metabase-types/api";
+const MB_STATS_ANALYTICS_UUID = "d97541bd-59b0-4656-b437-d659ac48eae1";
+
+const shouldReportSearchTerm = () =>
+ Settings.get("analytics-uuid") === MB_STATS_ANALYTICS_UUID;
+
type SearchRequestFilter = Pick<
SearchRequest,
| "created_by"
@@ -13,39 +19,91 @@ type SearchRequestFilter = Pick<
| "models"
| "archived"
| "q"
+ | "offset"
>;
+async function hashSearchTerm(searchTerm: string) {
+ try {
+ const analyticsUuid = Settings.get("analytics-uuid");
+ const saltedSearchTerm = searchTerm + "-salt-" + analyticsUuid;
+
+ const dataBuffer = new TextEncoder().encode(saltedSearchTerm);
+ const hashBuffer = await crypto.subtle.digest("SHA-256", dataBuffer);
+
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
+ return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
+ } catch (err) {
+ console.warn("Failed to hash search term", err);
+ return null;
+ }
+}
+
export const trackSearchRequest = (
searchRequest: SearchRequestFilter,
searchResponse: SearchResponse,
duration: number,
+ requestId: string | null = null,
) => {
- trackSchemaEvent("search", {
- event: "search_query",
- content_type: searchRequest.models ?? null,
- creator: !!searchRequest.created_by,
- creation_date: !!searchRequest.created_at,
- last_edit_date: !!searchRequest.last_edited_at,
- last_editor: !!searchRequest.last_edited_by,
- verified_items: !!searchRequest.verified,
- search_native_queries: !!searchRequest.search_native_query,
- search_archived: !!searchRequest.archived,
- context: searchRequest.context ?? null,
- runtime_milliseconds: duration,
- total_results: searchResponse.total,
- page_results: searchResponse.limit,
- });
+ const dispatchTrackSearchQuery = async () => {
+ trackSchemaEvent("search", {
+ event: "search_query",
+ search_term_hash: searchRequest.q
+ ? await hashSearchTerm(searchRequest.q)
+ : null,
+ search_term:
+ shouldReportSearchTerm() && searchRequest.q ? searchRequest.q : null,
+ content_type: searchRequest.models ?? null,
+ creator: !!searchRequest.created_by,
+ creation_date: !!searchRequest.created_at,
+ last_edit_date: !!searchRequest.last_edited_at,
+ last_editor: !!searchRequest.last_edited_by,
+ verified_items: !!searchRequest.verified,
+ search_native_queries: !!searchRequest.search_native_query,
+ search_archived: !!searchRequest.archived,
+ context: searchRequest.context ?? null,
+ runtime_milliseconds: duration,
+ total_results: searchResponse.total,
+ page_results: searchResponse.limit,
+ search_engine: searchResponse.engine,
+ request_id: requestId,
+ offset: searchRequest.offset ?? null,
+ });
+ };
+ dispatchTrackSearchQuery();
};
-export const trackSearchClick = (
- itemType: "item" | "view_more",
- position: number,
- context: SearchRequest["context"],
-) => {
- trackSchemaEvent("search", {
- event: "search_click",
- position,
- target_type: itemType,
- context: context ?? null,
- });
+type TrackSearchClickParams = {
+ itemType: "item" | "view_more";
+ position: number;
+ context: SearchRequest["context"];
+ searchEngine: string;
+ requestId?: string | null;
+ entityModel?: string | null;
+ searchTerm?: string | null;
+};
+
+export const trackSearchClick = ({
+ itemType,
+ position,
+ context,
+ searchEngine,
+ requestId = null,
+ entityModel = null,
+ searchTerm = null,
+}: TrackSearchClickParams) => {
+ const dispatchTrackSearchClick = async () => {
+ trackSchemaEvent("search", {
+ event: "search_click",
+ position,
+ target_type: itemType,
+ context: context ?? null,
+ search_engine: searchEngine,
+ request_id: requestId,
+ entity_model: entityModel,
+ search_term_hash: searchTerm ? await hashSearchTerm(searchTerm) : null,
+ search_term: shouldReportSearchTerm() && searchTerm ? searchTerm : null,
+ });
+ };
+
+ dispatchTrackSearchClick();
};
diff --git a/frontend/src/metabase/search/components/SearchResult/SearchResult.tsx b/frontend/src/metabase/search/components/SearchResult/SearchResult.tsx
index bf264efa648..8f7351f15dc 100644
--- a/frontend/src/metabase/search/components/SearchResult/SearchResult.tsx
+++ b/frontend/src/metabase/search/components/SearchResult/SearchResult.tsx
@@ -35,6 +35,9 @@ export function SearchResult({
className,
index,
context = "search-app",
+ searchEngine,
+ searchRequestId,
+ searchTerm,
}: {
result: WrappedResult;
compact?: boolean;
@@ -44,6 +47,9 @@ export function SearchResult({
className?: string;
index: number;
context?: SearchContext;
+ searchEngine?: string;
+ searchRequestId?: string;
+ searchTerm?: string;
}) {
const { name, model, description, moderated_status }: WrappedResult = result;
@@ -84,7 +90,15 @@ export function SearchResult({
onClick(result);
return;
}
- trackSearchClick("item", index, context);
+ trackSearchClick({
+ itemType: "item",
+ position: index,
+ context,
+ searchEngine: searchEngine || "unknown",
+ requestId: searchRequestId,
+ entityModel: result.model,
+ searchTerm,
+ });
onChangeLocation(result.getUrl());
};
diff --git a/frontend/src/metabase/search/containers/SearchApp.jsx b/frontend/src/metabase/search/containers/SearchApp.jsx
index 5890784f4d5..bf2f793e46b 100644
--- a/frontend/src/metabase/search/containers/SearchApp.jsx
+++ b/frontend/src/metabase/search/containers/SearchApp.jsx
@@ -72,7 +72,7 @@ function SearchApp({ location }) {
[onChangeLocation, searchText],
);
- const { data, error, isFetching } = useSearchQuery(query);
+ const { data, error, isFetching, requestId } = useSearchQuery(query);
const list = useMemo(() => {
return data?.data?.map((item) => Search.wrapEntity(item, dispatch)) ?? [];
}, [data, dispatch]);
@@ -103,7 +103,15 @@ function SearchApp({ location }) {
{!error && !isFetching && list.length > 0 && (
<Box>
- <SearchResultSection totalResults={data.total} results={list} />
+ <SearchResultSection
+ totalResults={data.total}
+ results={list}
+ searchEngine={data.engine}
+ searchRequestId={requestId}
+ searchTerm={searchText}
+ page={page}
+ pageSize={PAGE_SIZE}
+ />
<Group justify="flex-end" align="center" my="1rem">
<PaginationControls
showTotal
diff --git a/frontend/src/metabase/search/containers/SearchResultSection.tsx b/frontend/src/metabase/search/containers/SearchResultSection.tsx
index 3cd85ac0a86..efc58bfa2a3 100644
--- a/frontend/src/metabase/search/containers/SearchResultSection.tsx
+++ b/frontend/src/metabase/search/containers/SearchResultSection.tsx
@@ -7,9 +7,19 @@ import { Paper, Stack, Text } from "metabase/ui";
export const SearchResultSection = ({
results,
totalResults,
+ searchEngine,
+ searchRequestId,
+ searchTerm,
+ page,
+ pageSize,
}: {
results: WrappedResult[];
totalResults: number;
+ searchEngine?: string;
+ searchRequestId?: string;
+ searchTerm?: string;
+ page?: number;
+ pageSize?: number;
}) => {
const resultsLabel = ngettext(
msgid`${totalResults} result`,
@@ -24,11 +34,15 @@ export const SearchResultSection = ({
{resultsLabel}
</Text>
{results.map((item, index) => {
+ const absolutePosition = (page ?? 0) * (pageSize ?? 1) + index;
return (
<SearchResult
key={`${item.id}__${item.model}`}
result={item}
- index={index}
+ index={absolutePosition}
+ searchEngine={searchEngine}
+ searchRequestId={searchRequestId}
+ searchTerm={searchTerm}
/>
);
})}
diff --git a/snowplow/iglu-client-embedded/schemas/com.metabase/search/jsonschema/1-2-0 b/snowplow/iglu-client-embedded/schemas/com.metabase/search/jsonschema/1-2-0
new file mode 100644
index 00000000000..7540ee120c8
--- /dev/null
+++ b/snowplow/iglu-client-embedded/schemas/com.metabase/search/jsonschema/1-2-0
@@ -0,0 +1,208 @@
+{
+ "$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
+ "description": "Search events",
+ "self": {
+ "vendor": "com.metabase",
+ "name": "search",
+ "format": "jsonschema",
+ "version": "1-2-0"
+ },
+ "type": "object",
+ "properties": {
+ "event": {
+ "description": "Event name",
+ "type": "string",
+ "enum": [
+ "search_query",
+ "search_click",
+ "new_search_query",
+ "search_results_filtered"
+ ],
+ "maxLength": 1024
+ },
+ "runtime_milliseconds": {
+ "description": "Number of milliseconds it took to successfully run the search query",
+ "type": [
+ "integer",
+ "null"
+ ],
+ "minimum": 0,
+ "maximum": 2147483647
+ },
+ "context": {
+ "description": "Source of the search event",
+ "type": [
+ "string",
+ "null"
+ ],
+ "enum": [
+ "search-app",
+ "search-bar",
+ "command-palette",
+ "entity-picker"
+ ],
+ "maxLength": 1024
+ },
+ "total_results": {
+ "description": "The total number of results that matched the query",
+ "type": [
+ "integer",
+ "null"
+ ],
+ "minimum": 0,
+ "maximum": 2147483647
+ },
+ "page_results": {
+ "description": "The number of results returned per page",
+ "type": [
+ "integer",
+ "null"
+ ],
+ "minimum": 0,
+ "maximum": 2147483647
+ },
+ "position": {
+ "description": "The position of the result in the list that was clicked. Zero indexed",
+ "type": [
+ "integer",
+ "null"
+ ],
+ "minimum": 0,
+ "maximum": 2147483647
+ },
+ "target_type": {
+ "description": "The type of item in the search list that was clicked.",
+ "type": [
+ "string",
+ "null"
+ ],
+ "enum": [
+ "item",
+ "view_more"
+ ]
+ },
+ "content_type": {
+ "description": "Filter for entity types (question, database, model, etc.)",
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "description": "An entity type (card, question, dashboard, etc.)",
+ "type": "string",
+ "enum": [
+ "dashboard",
+ "card",
+ "dataset",
+ "collection",
+ "database",
+ "table",
+ "action"
+ ],
+ "maxLength": 1024
+ }
+ },
+ "creator": {
+ "description": "Filter for created by a user",
+ "type": [
+ "boolean",
+ "null"
+ ]
+ },
+ "last_editor": {
+ "description": "Filter for last edited by a user",
+ "type": [
+ "boolean",
+ "null"
+ ]
+ },
+ "creation_date": {
+ "description": "Filter for a time when a user creates an entity",
+ "type": [
+ "boolean",
+ "null"
+ ]
+ },
+ "last_edit_date": {
+ "description": "Filter for a time when a user last edited an entity",
+ "type": [
+ "boolean",
+ "null"
+ ]
+ },
+ "verified_items": {
+ "description": "Filter for entities that have been marked as verified",
+ "type": [
+ "boolean",
+ "null"
+ ]
+ },
+ "search_native_queries": {
+ "description": "Toggles whether search should include SQL and/or native queries",
+ "type": [
+ "boolean",
+ "null"
+ ]
+ },
+ "search_archived": {
+ "description": "Toggles whether search should include archived items",
+ "type": [
+ "boolean",
+ "null"
+ ]
+ },
+ "search_engine": {
+ "description": "The search engine used to perform the search",
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 1024
+ },
+ "request_id": {
+ "description": "The unique request ID for the search request",
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 1024
+ },
+ "offset": {
+ "description": "The offset of the search results (for pagination)",
+ "type": [
+ "integer",
+ "null"
+ ],
+ "minimum": 0,
+ "maximum": 2147483647
+ },
+ "entity_model": {
+ "description": "The model type of the clicked entity",
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 1024
+ },
+ "search_term_hash": {
+ "description": "A hash of the search term and instance id",
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 1024
+ },
+ "search_term": {
+ "description": "The search term as a string (only reported for specific analytics UUIDs)",
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 1024
+ }
+ },
+ "required": [
+ "event"
+ ],
+ "additionalProperties": true
+}