SearchRelevance
Unofficial
Scores search results for the byRelevance sort order of a ResultDom.
A search builds one per query from the query’s matcher. An exact title or alias match ranks highest; other matches are weighted by where each term matched and how close it was to a whole word.
Import:
import type { SearchRelevance } from '@obsidian-typings/obsidian-catalyst-latest';Signature:
export interface SearchRelevanceProperties
| Property | Type | Description | |
|---|---|---|---|
| app | App | The app instance. | |
| caseSensitive | boolean | Whether the query matches case-sensitively. | |
| matcher | SearchMatcher | The root of the query's compiled matcher tree. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| matchesTitle(file) | boolean | Check whether any term of the query matches the file's name. | |
| score(file, result, content) | number | Compute a file's relevance score for the query. A higher score sorts first. |
Links to this page: