SearchMatchContext
Unofficial
The per-file context a search matcher evaluates against.
Import:
import type { SearchMatchContext } from '@obsidian-typings/obsidian-public-latest';Signature:
export interface SearchMatchContextConstructor
new SearchMatchContext(strings: Record<string, string>, original: string, keys: string[], caseSensitive: boolean)Constructor.
Properties
| Property | Type | Description | |
|---|---|---|---|
| cache | CachedMetadata | null | undefined | The metadata cache of the file being matched, when it has one. | |
| caseSensitive | boolean | Whether the query is matched case-sensitively. | |
| data | Map<unknown, unknown> | null | Values attached to the context by the matchers, or null when there are none. | |
| keys | string[] | The inputs, by name, that the matchers search: a subset of the keys of SearchMatchContext.strings. | |
| original | string | The original text the context was created for. | |
| strings | Record<string, string> | The input strings by name: content, filename, filepath, propertyName or tag. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| clone() | SearchMatchContext | Copies the context. SearchMatchContext.strings, SearchMatchContext.keys and SearchMatchContext.data are copied; SearchMatchContext.cache is shared. | |
| cloneForPropertyContent(value) | SearchMatchContext | Copies the context for matching a property value, which becomes the only (content) input. | |
| deleteData(key) | void | Removes a value attached to the context. | |
| getData(key) | unknown | Reads a value attached to the context. | |
| setData(key, value) | void | Attaches a value to the context. |