diff --git a/content/search-github/github-code-search/understanding-github-code-search-syntax.md b/content/search-github/github-code-search/understanding-github-code-search-syntax.md index 79a873b8c117..80d85ca89445 100644 --- a/content/search-github/github-code-search/understanding-github-code-search-syntax.md +++ b/content/search-github/github-code-search/understanding-github-code-search-syntax.md @@ -100,6 +100,7 @@ You can use parentheses to express more complicated boolean expressions. For exa You can use specialized keywords to qualify your search. * [Repository qualifier](#repository-qualifier) * [Organization and user qualifiers](#organization-and-user-qualifiers) +* [Enterprise qualifier](#enterprise-qualifier) * [Language qualifier](#language-qualifier) * [Path qualifier](#path-qualifier) * [Symbol qualifier](#symbol-qualifier) @@ -140,6 +141,16 @@ user:octocat > [!NOTE] > Code search does not currently support regular expressions or partial matching for organization or user names, so you will have to type the entire organization or user name for the qualifier to work. +### Enterprise qualifier + +To search for files within an enterprise, use the `enterprise:` qualifier. For example: + +```text +enterprise:octocorp +``` + +This searches repositories owned by organizations in the `octocorp` enterprise. User-owned repositories are not included. + ### Language qualifier To narrow down to a specific languages, use the `language:` qualifier. For example: diff --git a/src/events/components/events.ts b/src/events/components/events.ts index 6a57c39ca8ca..b0a59990ba14 100644 --- a/src/events/components/events.ts +++ b/src/events/components/events.ts @@ -110,6 +110,7 @@ export function sendEvent({ path_article: getMetaContent('path-article'), page_document_type: getMetaContent('page-document-type'), page_type: getMetaContent('page-type'), + content_type: getMetaContent('page-content-type'), status: Number(getMetaContent('status') || 0), is_logged_in: isLoggedIn(), diff --git a/src/events/lib/schema.ts b/src/events/lib/schema.ts index 92e72c75118b..3f1bb45ccddd 100644 --- a/src/events/lib/schema.ts +++ b/src/events/lib/schema.ts @@ -2,6 +2,7 @@ import { languageKeys } from '@/languages/lib/languages-server' import { allVersionKeys } from '@/versions/lib/all-versions' import { productIds } from '@/products/lib/all-products' import { allTools } from '@/tools/lib/all-tools' +import { contentTypesEnum } from '@/frame/lib/frontmatter' const versionPattern = '^\\d+(\\.\\d+)?(\\.\\d+)?$' @@ -100,6 +101,11 @@ const context = { description: 'Optional page type from the content frontmatter.', enum: ['overview', 'quick_start', 'tutorial', 'how_to', 'reference', 'rai'], // frontmatter.ts }, + content_type: { + type: 'string', + description: 'Optional content type from the content frontmatter (EDI content models).', + enum: contentTypesEnum, + }, status: { type: 'number', description: 'The HTTP response status code of the main page HTML.', diff --git a/src/events/tests/middleware.ts b/src/events/tests/middleware.ts index a485892aa6dd..a450878436d0 100644 --- a/src/events/tests/middleware.ts +++ b/src/events/tests/middleware.ts @@ -1,6 +1,7 @@ import { describe, expect, test, vi } from 'vitest' import { post } from '@/tests/helpers/e2etest' +import { contentTypesEnum } from '@/frame/lib/frontmatter' describe('POST /events', () => { vi.setConfig({ testTimeout: 60 * 1000 }) @@ -163,4 +164,28 @@ describe('POST /events', () => { }) expect(statusCode).toBe(400) }) + + test('should accept content_type field', async () => { + const { statusCode } = await checkEvent({ + ...pageExample, + context: { + ...pageExample.context, + content_type: 'how-tos', + }, + }) + expect(statusCode).toBe(200) + }) + + test('should accept valid content_type values from EDI content models', async () => { + for (const contentType of contentTypesEnum) { + const { statusCode } = await checkEvent({ + ...pageExample, + context: { + ...pageExample.context, + content_type: contentType, + }, + }) + expect(statusCode).toBe(200) + } + }) }) diff --git a/src/events/types.ts b/src/events/types.ts index 5ce0be05c8cf..36e63d0dc7eb 100644 --- a/src/events/types.ts +++ b/src/events/types.ts @@ -36,6 +36,7 @@ export type EventProps = { path_article: string page_document_type: string page_type: string + content_type: string status: number is_logged_in: boolean dotcom_user: string diff --git a/src/frame/components/DefaultLayout.tsx b/src/frame/components/DefaultLayout.tsx index a23a377995c7..b57e727d6814 100644 --- a/src/frame/components/DefaultLayout.tsx +++ b/src/frame/components/DefaultLayout.tsx @@ -119,6 +119,7 @@ export const DefaultLayout = (props: Props) => { /> )} {page.type && } + {page.contentType && } {page.documentType && } {status && } diff --git a/src/frame/components/context/MainContext.tsx b/src/frame/components/context/MainContext.tsx index f90691cd4d8a..10fcb7a42b58 100644 --- a/src/frame/components/context/MainContext.tsx +++ b/src/frame/components/context/MainContext.tsx @@ -118,6 +118,7 @@ export type MainContextT = { page: { documentType: string type?: string + contentType?: string topics: Array title: string fullTitle?: string @@ -217,6 +218,7 @@ export const getMainContext = async (req: any, res: any): Promise (page && { documentType, type: req.context.page.type || null, + contentType: req.context.page.contentType || null, title: req.context.page.title, fullTitle: req.context.page.fullTitle || null, topics: req.context.page.topics || [], diff --git a/src/types.ts b/src/types.ts index 3c39cac8056f..b39896326926 100644 --- a/src/types.ts +++ b/src/types.ts @@ -51,6 +51,7 @@ export type PageFrontmatter = { featuredLinks?: FeaturedLinks changelog?: ChangeLog type?: string + contentType?: string topics?: string[] includeGuides?: string[] learningTracks?: string[] @@ -380,6 +381,8 @@ export type Page = { complexity?: string[] industry?: string[] sidebarLink?: SidebarLink + type?: string + contentType?: string } export type SidebarLink = {