Skip to main content

Function: searchModel()

function searchModel(
model,
query,
options?
): SearchHit[];

Case- and accent-insensitive. Score: exact name 100 > prefix 80 > word-start 60 > substring 40

subsequence (fuzzy, all chars in order) 20; tables before columns on ties, then model order. schema.table, table.column and aliases match too. Empty query → [].

Sticky notes match by name only, not by content.

Parameters​

model​

DiagramModel

query​

string

options?​

SearchOptions = {}

Returns​

SearchHit[]

Example​

import { compileDbml, searchModel } from '@relvista/core';

const { model } = compileDbml(source);
const hits = searchModel(model!, 'user', { kinds: ['table', 'column'], limit: 10 });
hits[0]; // { kind: 'table', id: 'public.users', label: 'users', ranges: [[0, 4]], ... }