Home / Function/ createModelFromMatch() — supabase Function Reference

createModelFromMatch() — supabase Function Reference

Architecture documentation for the createModelFromMatch() function in globalSearchModel.ts from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/docs/resources/globalSearch/globalSearchModel.ts lines 88–140

function createModelFromMatch({
  type,
  page_title,
  href,
  content,
  metadata,
  subsections,
}: DatabaseCorrected['public']['Functions']['search_content']['Returns'][number]): SearchResultInterface | null {
  switch (type) {
    case 'markdown':
      return new GuideModel({
        title: page_title,
        href,
        content,
        subsections,
      })
    case 'reference':
      const { language } = metadata
      if (language && SDKLanguageValues.includes(language)) {
        return new ReferenceSDKFunctionModel({
          title: page_title,
          href,
          content,
          language,
          methodName: metadata.methodName,
        })
      } else if (metadata.platform === DB_METADATA_TAG_PLATFORM_CLI) {
        return new ReferenceCLICommandModel({
          title: page_title,
          href,
          content,
          subsections,
        })
        // TODO [Charis 2025-06-09] replace with less hacky check
      } else if (metadata.subtitle?.startsWith('Management API Reference')) {
        return new ReferenceManagementApiModel({
          title: page_title,
          href,
          content,
        })
      } else {
        return null
      }
    case 'github-discussions':
      return new TroubleshootingModel({
        title: page_title,
        href,
        content,
      })
    default:
      return null
  }
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free